Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next build wont work after updating from [email protected] to [email protected] #17744

Closed
tairosonloa opened this issue Oct 9, 2020 · 5 comments

Comments

@tairosonloa
Copy link

tairosonloa commented Oct 9, 2020

Bug report

Describe the bug

The command next build fails on [email protected] but works fine in [email protected].
The error log is the following:

$ next build
Loaded env from /home/aalonso/workspaces/aalonso.dev/.env.local
info  - Using external babel configuration from /home/aalonso/workspaces/aalonso.dev/.babelrc
info  - Creating an optimized production build  
Failed to compile.

./src/containers/Cover/Cover.module.scss
Error: Can't resolve '/images/cover.webp' in '/home/aalonso/workspaces/aalonso.dev/src/containers/Cover'
    at runMicrotasks (<anonymous>)


> Build error occurred
Error: > Build failed because of webpack errors
    at build (/home/aalonso/workspaces/aalonso.dev/node_modules/next/dist/build/index.js:15:918)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This happens when resolving an image URL from SCSS. The SCSS (./src/containers/Cover/Cover.module.scss):

.container {
  ...
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('/images/cover.webp');
  ...
}

The folders structure of the repository:

./
|- package.json
|- .babelrc
|   ...
|- src/
   |- containers/
      |- Cover/
         |- Cover.module.scss
|- public/
   |- images/
      |- cover.webp

.babelrc

{
  "presets": ["next/babel"],
  "plugins": []
}

To Reproduce

Just run next build on this branch of this public repository:
https://github.com/tairosonloa/aalonso.dev/tree/dependabot/npm_and_yarn/next-9.5.4
NOTE: if you run yarn build or npm run build, process will throw if you don't set the env variable DOMAIN, as it tries to execute also the npm prebuild command, which requires the env variable to be set.
To fix it, just run export DOMAIN=aalonso.dev on your terminal.

Here is the GitHub actions log with the failing build stage:
https://github.com/tairosonloa/aalonso.dev/pull/115/checks?check_run_id=1230832954

Here is the GitHub actions log passing build step for the previous commit (before the next dependency update):
https://github.com/tairosonloa/aalonso.dev/runs/1230831205?check_suite_focus=true

Expected behavior

The build process should resolve the image path and finish without errors, like in the previous build processes.

System information

  • OS: Ubuntu-Latest (GitHub Actions and WSL)
  • Version of Next.js: 9.5.4
  • Version of Node.js: v12.X (GitHub Actions) and v12.19.0 (WSL)
@vgribdev
Copy link

vgribdev commented Oct 9, 2020

I have the same problem with fonts,
Error: Can't resolve '/fonts/PoppinsRegular.woff2',
It was working with 9.5.3

@madsfaerch
Copy link

madsfaerch commented Oct 9, 2020

Duplicate of #17701 and #17728

Install [email protected] until stable

@timneutkens
Copy link
Member

Duplicate of #17701, this was already fixed pending a stable release.

@tairosonloa
Copy link
Author

I'm sorry, as issue #17701 was closed I didn't see it was a duplicated. Best regards

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants