I am having a problem with deploying the next.js app to Heroku. Builder says:
remote: postcss-resolve-url: postcss.plugin was deprecated. Migration guide:
remote: https://evilmartians.com/chronicles/postcss-8-plugin-migration
remote: Failed to compile.
remote:
remote: ./pages/index.js
remote: Module not found: Can't resolve '../styles/Constructionpage.module.scss' in '/tmp/build_642a3d7a/pages'
remote:
This is my /pages/index.js file imports:
import style from "../styles/Constructionpage.module.scss";
import Head from "next/head";
The structure looks like this:
pages
-index.js
styles
-Constructionpage.module.scss
But locally everything works without any errors/warnings. Does anyone have an idea why this happens? Thanks!
CodePudding user response:
When you're running your site with yarn dev
, you're using your local server to render your site as you navigate to each page. When you build, Next generates every page on your site. Your error is likely coming from a page you didn't access in dev.
Remember that Next is set up for server side rendering static assets, so it will ingest whatever data (and CSS) you give it and give you back a performance-optimized set of pages that get rehydrated client-side.
PostCSS
is natively set up to work with Next.js. Check their docs, you'd have to provide a lot more background to debug this if it's still giving you trouble.
CodePudding user response:
I've just changed the name of file to the initial one.