I want to convert pure React app to NextJs app. In React app I’m importing .scss CSS files in multiple places of components.
Once I move the code into Next.js environment it is showing error:
Gobal CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
I want my CSS to be imported in their places as Global CSS.
Any configuration helps here?
2
Answers
In your Next.js project you have
styles
folder which includesglobal.css
file, if you want to create specific style file and import it anywhere in your files you should name it as*.module.scss
and import it to desired destination