'Webpack: any way to create a bundle consisting of two files where one imports data from an other?

Let's assume we have a javascript project and use webpack. In this example we have 4 js-files:

  1. index.js
  2. function1.js
  3. function2.js
  4. object.js

index.js is the entry point that imports functions from the function1.js and function2.js files as well as imports an object from the object.js file and eventually does something useful.

Task: there is a need to create two output files. The first file, bundle.js, shall be a bundle of index.js, function1.js and function2.js. The second file, the object.js, shall be the object.js we had before.

But the bundle.js and the new object.js still shall communicate with each other (the final bundle.js shall import object data from the final object.js).

Is there any way to create these two output js-files automatically?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source