Reputation: 1304
Suppose I have two files
a.js:
alert("hello from a.js");
b.js
alert("hello from b.js");
is there any way to bundle them with WebPack so that
Upvotes: 8
Views: 6338
Reputation: 3959
For me personally, this webpack plugin was most helpful and headache free: https://www.npmjs.com/package/webpack-merge-and-include-globally
Upvotes: 2
Reputation: 1890
For anyone else that comes looking, the new (webpack 4+) link to the docs on shimming is here: https://webpack.js.org/guides/shimming/
Upvotes: 2
Reputation: 867
Webpack natively supports CommonJS ( require / import ) and AMD style, and since yours are not falling into those categories, I believe you should look at the shimming modules section
https://github.com/webpack/docs/wiki/shimming-modules
This is from their header
In some cases webpack cannot parse some file, because it has a unsupported module format or isn't even in a module format. Therefore you have many options to convert the file into a module.
Upvotes: 5