With a fresh install of NextJS I wanted to add SCSS support. The documentation is very clear about it how to do this. When I install as described and add an import of scss as follows:
import "@/styles/styles.scss";
import type { AppProps } from "next/app";
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
Then run npm run dev
. In the browser my page keeps loading. When I exit the script and remove the line import "@/styles/styles.scss";
and then run the dev command the page will show up in my browser, but when I enable again the scss import again I get a compile error.
error - unhandledRejection: Error: Cannot find module '/...../node_modules/next/dist/compiled/sass-loader/fibers.js'
at webpackEmptyContext (/...../node_modules/next/dist/compiled/sass-loader/cjs.js:1:11235)
at getSassOptions (/.....//node_modules/next/dist/compiled/sass-loader/cjs.js:1:5586)
at Object.loader (/.....//node_modules/next/dist/compiled/sass-loader/cjs.js:1:2683)
at LOADER_EXECUTION ......
{
code: 'MODULE_NOT_FOUND
}