question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

libraryTarget umd & code splitting

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
AndyOGocommented, Mar 12, 2018

@sokra I would need this feature too. Could you consider to reopen this?

2reactions
AndyOGocommented, Mar 21, 2018

@davidagraf @alexcastillo @monteraphael @LucaMele @sokra

I just created a new ticket, cause this was not reopenend, at #6818

Read more comments on GitHub >

github_iconTop Results From Across the Web

libraryTarget UMD and code splitting · Issue #6818 - GitHub
When splitting code in webpack, the chunks are loaded with temporary script tags: ... libraryTarget UMD and code splitting #6818.
Read more >
Webpack Code Splitting for your Library - Robin Wieruch
A walkthrough on how to use code splitting for your library to reduce your bundle size by giving multiple entry points to your...
Read more >
Webpack 4: How to set up Code Splitting for a library ...
My Webpack is outputting the individual files, but it's not splitting out common code in a way that an app can consume the...
Read more >
Output - webpack
However, when creating multiple bundles via more than one entry point, code splitting, or various plugins, you should use one of the following...
Read more >
Understanding the Webpack Dynamics | by Param Singh
Development tools like Hot reloading, dev server; Code splitting and on ... Specifying the libraryTarget as umd which stands for Universal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found