Visitar URL original
Not a webpack bundle unhandled rejection on every chunk · Issue #10 · developit/optimize-plugin · GitHub
Skip to content

Not a webpack bundle unhandled rejection on every chunk #10

Description

@keepitterron

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? 🙏

Activity

  1. developit commented on Dec 14, 2020

    @developit
    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?

  2. keepitterron commented on Dec 14, 2020

    @keepitterron
    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.

  3. developit commented on Dec 18, 2020

    @developit
    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.

  4. keepitterron commented on Dec 20, 2020

    @keepitterron
    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 :)

  5. developit commented on Dec 21, 2020

    @developit
    Owner
  6. 3zzy commented on Dec 28, 2020

    @3zzy

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

  7. developit commented on Feb 24, 2021

    @developit
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoMore information is needed to diagnose.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions