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

Dynamic chunks not created when running next build twice #5213

Closed
tusbar opened this issue Sep 19, 2018 · 1 comment · Fixed by #5249
Closed

Dynamic chunks not created when running next build twice #5213

tusbar opened this issue Sep 19, 2018 · 1 comment · Fixed by #5249

Comments

@tusbar
Copy link
Contributor

tusbar commented Sep 19, 2018

Bug report

Describe the bug

Running next build twice will somehow not create the dynamic chunks on the 2nd run. Instead, the pages using the dynamic components (loaded using dynamic(import(…))) will all contain what should be included in the dynamic chunks.

Running a 3rd time makes the build fail.

To Reproduce

The issue is easily reproducible with the following repository: https://github.com/tusbar/next-js-dynamic-issue

  1. rm -rf node_modules/.cache
  2. next build, everything runs smoothly, generated bundles are correct.
  3. next build again. The build runs faster thanks to hardsource, but the dynamic chunks are not created, the code from the dynamically imported components is moved to each of the pages using them.
  4. next build again. The build errors with stuff like:
[hardsource:5dfb5712] Could not freeze ./components/dynamic-message.js: Cannot read property 'hash' of undefined

Expected behavior

2 sequential build should create the same bundles.

System information

  • OS: macOs
  • Version of Next.js: 7.0.0
@tusbar
Copy link
Contributor Author

tusbar commented Sep 20, 2018

There are definitely some issues with hard-source-webpack-plugin:

@lock lock bot locked as resolved and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant