Skip to content

libraryTarget umd & code splitting #2471

@davidagraf

Description

@davidagraf

When splitting code in webpack, the chunks are loaded with temporary script tags:

/******/    var head = document.getElementsByTagName('head')[0];
/******/    var script = document.createElement('script');
/******/    script.type = 'text/javascript';
/******/    script.charset = 'utf-8';
/******/    script.async = true;
/******/    script.timeout = 120000;

/******/    script.src = __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "." + "<some_key>" + ".js";

When creating an umd library, the library might be loaded by another bundler again (webpack, jspm, etc.). In that case, the script tag loading isn't nice. It would be better to keep the AMD (or System.import for webpack 2) in the chunks which will be interpreted by the other bundler. I didn't find an option to enable this. Is it a missing feature? Or am I missing something and code splitting in umd libraries not possible?

Activity

sokra

sokra commented on May 11, 2016

@sokra
Member

It's a missing feature..

davidagraf

davidagraf commented on May 12, 2016

@davidagraf
Author

This feature would be super handy for us. What's the difficulty in implementing it? I guess, replacing the temp script stuff with System.import is not complicated, right? Is the problem the current jsonp in the bundles?

webpack-bot

webpack-bot commented on Jan 3, 2018

@webpack-bot
Contributor

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

webpack-bot

webpack-bot commented on Jan 19, 2018

@webpack-bot
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

11 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bebraw@davidagraf@AndyOGo@alexcastillo@sokra

        Issue actions

          libraryTarget umd & code splitting · Issue #2471 · webpack/webpack