I've just spun up a new Next.js project (React v 17.0.1). I am attempting to compile and import components from a legacy project. Seeing a few errors getting things to work:
Module not found: Can't resolve 'react/jsx-dev-runtime'. I have a hunch this may have something to do with the new JSX compiler in React 17.- This can be resolved by adding
/** @jsxRuntime classic */to the top of the file, but i'd prefer to just turn on the classic compiler. Is this possible?
- This can be resolved by adding
Global CSS cannot be imported from files other than your Custom <App>- This can be resolved by using modules, or importing in
pages/_app. However, i'd like to turn this safety feature off, leaving the legacy components as is.
- This can be resolved by using modules, or importing in
Questions:
- How can I force Next.js to use the
classicJSX compiler instead of the newautomaticone - How do I turn off the safety "feature" forcing CSS to only be imported to
_app?
_appcomponent, that is how next.js operates. You can import scoped CSS in single components as described here: nextjs.org/docs/basic-features/… I don't know if this is applicable for your case.