![]() ![]() Unfortunately, there are too many third-party libraries that do not play nice with Webpack (as I just discovered today), so pragmatically speaking you're better off installing modules in the distribution folder anyway. I disagree with the comments that suggest Webpack was not designed to bundle Node scripts, considering that Webpack has a specific setting for just that ( target). Bundling your code with your dependencies makes it virtually impossible. But bundling Lodash in your library will actually make it included twice, since npm is no longer managing this dependency.Īs a consumer of a library, I want the library code to include only its logic, and just state its dependencies so they could me merged/resolved with the rest of the dependencies in my project. If you're using Lodash, and the consumer of your library also has the same Lodash dependency, npm makes sure that it will be added only once. It goes against the entire npm dependencies management. ![]() However - you wouldn't want to bundle your code with its entire node_modules dependencies, for two reasons: When writing a node library, for instance, you may want to split your code to several files, and use Webpack to bundle them. webpack-node-external appears to be designed for use of NodeJS libraries, not standalone apps. Questions: I have an existing PHP project with jquery and bootstrap, not using any front-end frame.Questions: I have an existing PHP project with jquery and bootstrap, not using any front-end. I think you are correct that in your case, bundling into a single file would make more sense.
0 Comments
Leave a Reply. |