2

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:

  1. 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?
  2. 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.

Questions:

  1. How can I force Next.js to use the classic JSX compiler instead of the new automatic one
  2. How do I turn off the safety "feature" forcing CSS to only be imported to _app?
2

1 Answer 1

1

This was solved by downgrading the React dependency to 16 in package.json

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.