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

9.0.5 Dynamic imports not extracted to chunks #8550

Closed
thebuilder opened this issue Aug 29, 2019 · 2 comments · Fixed by #8569
Closed

9.0.5 Dynamic imports not extracted to chunks #8550

thebuilder opened this issue Aug 29, 2019 · 2 comments · Fixed by #8569
Assignees
Milestone

Comments

@thebuilder
Copy link

Bug report

Describe the bug

After upgrading from 9.0.4 to 9.0.5, dynamic(() => import()) are now all merged into commons.js, and no chunks are exported. Before it would create a new chunk for each.

It only happens when building for prodution with target: serverless. Running in development, the chunks are still generated correctly

Example

I've created a simple Codesandbox that just adds a single import(). It correctly chunks and loads the chunk on 9.0.4.

See the Network Requests.

Expected behavior

When using the dynamic imports, they should be extracted into chunks by Webpack.

@Timer
Copy link
Member

Timer commented Aug 30, 2019

Traced this down:

5ad0ea8e5b426183601cc28e98f158bcf2d0c524 is the first bad commit
commit 5ad0ea8e5b426183601cc28e98f158bcf2d0c524
Author: Joe Haddad <timer150@gmail.com>
Date:   Tue Aug 20 12:38:14 2019 -0400

    Remove `__NEXT_REPLACE__BUILD_ID__` workaround (#8445)
    
    We no longer need this because we don't run terser on serverless bundles.
    
    ---
    
    Closes https://github.com/zeit/next.js/issues/8436

 packages/next/build/entries.ts                     |  1 +
 packages/next/build/webpack-config.ts              |  6 +-
 .../webpack/loaders/next-serverless-loader.ts      |  4 +-
 .../build/webpack/plugins/serverless-plugin.ts     | 96 +++-------------------
 4 files changed, 18 insertions(+), 89 deletions(-)

@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 30, 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

Successfully merging a pull request may close this issue.

4 participants