I'm trying to use .scss for my styles and getting the following error:
Global CSS cannot be imported from files other than your Custom <App>. Please move all global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js
The way this blog is structured from the tutorial there is no _app.js file. The index.js file is the top level... component (not sure what the name of this file is)?
I do not want to use css modules (we are globally using bootstrap and need to load things globally) and will need to port over the existing .scss structure that I have already established.
I'm new to next/react so im not quite sure how to structure things to have a _app.js file and load the global style. My google-fu is failing me right now so am quite stuck.
Hey there, Niki! Thanks for posting the link to the repo, that was really helpful and I was able to get your code running with your styles.
Your hunch is right that we are going to need to add a _app.js file. Next.js has a default App component, but we can override it by declaring our own _app.js file. We can set it up as described here.
This is where we need to move the import '../styles/blog.scss' line.
So I've created pages/_app.js and it contains this code: