Skip to content

ES module bundled library using dynamic import + publicPath does not work with ES module bundled app #19495

@bsunderhus

Description

@bsunderhus

Bug report

What is the current behavior?

Here's an reproduction: https://stackblitz.com/edit/webpack-webpack-js-org-k3ddnttj

Seems like webpack fails to load dynamic imports from nested bundles if they point to a dynamic path (custom public path, or a CDN for example)

If the current behavior is a bug, please provide the steps to reproduce.

run:

  1. npm run build
    • it'll build two separate bundles:
      • one for an ES library that has a dynamic import for a chunk that will be served in localhost:9010
      • one for the app itself, the app will consume the ES library called entry and aliased to point to the generated ES library bundle
  2. npm start - it'll start two servers concurrently, one serving the distribution folder on port 5000 and another serving just the chunks to be consumed by the ES library on port 9010
  3. access application on localhost:5000 and this error will be on the console: Image

What is the expected behavior?

Webpack application should consume dynamic import pointing to dynamic paths properly

Other relevant information:
webpack version: 5.99.7
Node.js version:
Operating System:
Additional tools:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions