-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Configuring library as external in webpack does not work like expected with UMD as libraryTarget #4824
Comments
Yep, this looks like a bug. webpack doesn't generate the CJS harmony interop layer for externals. |
If you give me any hint where to look and how to pass this problem, I could try to fix it and contribute. |
Same Issue, Here, (more or less); I have a custom umd library (mylib) made by myself (bundled with webpack, of course); when I try to consume it in my application (bundled also with webpack) as "externals", it simply doesn't work. The output of application (app.js)
always has WEBPACK_EXTERNAL_MODULE_364 as undefined |
Any update? I am also facing the same issue with AMD |
It's one of most important thing ( |
Any news? |
I am also stuck here! |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Fixed in webpack@5, now we use |
For maintainers only:
|
Do you want to request a feature or report a bug?
I assume this could be a bug.
What is the current behavior?
I want to build my own JavaScript library and register it under an already existing namespace ("OCA" - in this particular case). Therefore I use webpack 2 and the libraryTarget: umd to register the output under "OCA.Ocr" (my library is named "Ocr"). This works like intended, but when it comes to the point that I want to use for example underscorejs as a library which will be included in the html later, I cannot get it to work. I followed the webpack configuration documentation and it says that the externals configuration option should be the way to go. But if I use it like stated in the documentation, the underscore library in this case is not defined. I also checked, that the library is available in the global namespace and the file gets loaded before my webpack bundle.
If the current behavior is a bug, please provide the steps to reproduce.
my webpack.config.js
my typescript code
webpack bundle
Firefox says:
What is the expected behavior?
No TypeError should be thrown and the underscorejs (
_
) library should be also available for the library bundled with webpacka as an external. (Like stated in the documentation)Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack Version: 2.5.0
Node: 6.10.2
OS: Debian Jessie
Browser: Firefox ESR 45.9.0
Also related is my stackoverflow question as I actually don't know if this is my fault or if this is a bug. (Maybe it would be at least nice to give more information regarding such use case in the documentation)
The text was updated successfully, but these errors were encountered: