Bug report
Describe the bug
When you use react a component residing outside the main Next.js project folder which uses hooks. You end up getting Invalid hook call error and the application breaks. Components without hooks work as expected.
The bug appears in all versions >9.0.5 when you change the webpack config so that files outside the main folder are transpiled. It’s working fine in <=9.0.5
To Reproduce
Check out the repro at https://github.com/baldurh/next-9.0.6-bug-repro
Expected behavior
The code should not break when using files outside the project folder.
System information
- OS: N/A
- Browser: N/A
- Version of Next.js:
>=9.0.6
Additional context
I know this is probably not a common use of Next.js but in our project we’re using a monorepo and have a shared folder with components used by multiple applications. It would be nice to get this working again. If someone finds an alternative config we could use I’d also be happy to do that 🙂
Bug report
Describe the bug
When you use react a component residing outside the main Next.js project folder which uses hooks. You end up getting
Invalid hook callerror and the application breaks. Components without hooks work as expected.The bug appears in all versions
>9.0.5when you change the webpack config so that files outside the main folder are transpiled. It’s working fine in<=9.0.5To Reproduce
Check out the repro at https://github.com/baldurh/next-9.0.6-bug-repro
Expected behavior
The code should not break when using files outside the project folder.
System information
>=9.0.6Additional context
I know this is probably not a common use of Next.js but in our project we’re using a monorepo and have a shared folder with components used by multiple applications. It would be nice to get this working again. If someone finds an alternative config we could use I’d also be happy to do that 🙂