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

Not a webpack bundle unhandled rejection on every chunk #10

Open
keepitterron opened this issue Dec 12, 2020 · 7 comments
Open

Not a webpack bundle unhandled rejection on every chunk #10

keepitterron opened this issue Dec 12, 2020 · 7 comments
Labels
needs more info More information is needed to diagnose.

Comments

@keepitterron
Copy link

keepitterron commented Dec 12, 2020

Multi entry webpack 4 (latest) configuration on Node 14.
It does this for every chunk

errored out during transformation  Error: /Users/claudio/Projects/loom/js/404-3594367e1117c0d15bb5.js: Not a webpack bundle
    at mod (/Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:203:15)
    at /Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:211:9
    at Array.forEach (<anonymous>)
    at getWebpackModules (/Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:207:10)
    at getWebpackBootstrap (/Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:85:25)
    at /Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:256:29
    at Array.forEach (<anonymous>)
    at PluginPass.Program (/Users/claudio/Projects/loom/node_modules/optimize-plugin/dist/worker.js:255:26)
    at newFn (/Users/claudio/Projects/loom/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/claudio/Projects/loom/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:55:20) {
  type: 'Error',
  code: 'BABEL_TRANSFORM_ERROR'
}

Any pointers? 🙏

@developit
Copy link
Owner

Hiya - this seems the same as the second issue mentioned in #7.
Are you able to share your Webpack configuration - in particular the mode, target and output options?

@developit developit added the needs more info More information is needed to diagnose. label Dec 14, 2020
@keepitterron
Copy link
Author

Absolutely!

{
  "entry":{
    ...multiple entries
  },
  "output":{
     "path":"/Users/claudio/Projects/loom/dist/webpack",
     "publicPath":"https://cdn.loom.com/assets/",
     "filename":"js/[name]-[contenthash].js"
  },
  "devtool":false,
  "module":{
     "rules":[...rules]
  },
  "optimization":{
     "moduleIds":"hashed",
     "splitChunks":{
        "cacheGroups":{
           "default":false,
           "commons":{
              "name":"commons",
              "test":{
                 
              },
              "chunks":"all",
              "minChunks":3
           }
        }
     },
  },
  "plugins":[...plugins],
  "resolve":{...aliases only},
  "mode":"production"
}

babel.config contains preset/react and preset/env with no modules nor target options set.

@developit
Copy link
Owner

Awesome, thanks for this. I will try to set up a test case. I likely missed some bundle parsing cases for multi-entry since I avoid using multi-entry whenever possible for performance reasons.

@keepitterron
Copy link
Author

Oh that's very interesting. I can intuitively understand why would it be a performance drain, do you have any links where I can learn more (multi entry webpack)? 🙏
I'll do some digging of my own in the meanwhile :)

@developit
Copy link
Owner

@keepitterron it's a little buried in the docs, but there now:
https://webpack.js.org/plugins/module-concatenation-plugin/#optimization-bailouts

@3zzy
Copy link

3zzy commented Dec 28, 2020

We bundle multiple separate 'apps' so we definitely need multiple entries, not something we can avoid unfortunately.

@developit
Copy link
Owner

For those hitting this issue, you can disable automatic modernization via new OptimizePlugin({ modernize: false }). This improves performance, but will use the unmodified ES5 source of most npm modules since they do not publish modern code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is needed to diagnose.
Projects
None yet
Development

No branches or pull requests

3 participants