If I have two pages named Page1
and Page2
, both utilizing libraries like jquery
and backbone
that I want to combine into a single file, with shared modules (excluding the vendors) in another file, here is the webpack configuration:
Some example code here...
However, under this configuration:
common.js
contains webpack runtime,
page1.js
includes page1 specific modules as well as shared modules
page2.js
includes page2 specific modules as well as shared modules
This leads to duplication of code in page1.js
and page2.js
.
Attempting to improve this, I adjusted the configuration as follows:
Updated code snippet...
After making these changes:
common.js
now consists of webpack runtime, vendor libraries, and shared modules
vendor.js
contains the webpack runtime and vendor libraries only.
page1.js
includes page1 specific modules
page2.js
includes page2 specific modules
While this seems like progress, the inclusion of vendors in common.js
may not be desired.
Is there something incorrect in this setup?