1

In my webpack config, I am using the standard use of split chunks:

optimization: {
    splitChunks: {
      // include all types of chunks
      chunks: 'all',
    },
  },

This properly creates a vendors chunk, and decouples my node modules from my various JS entrypoints.

However, there is one entrypoint that uses a very limited subset of node modules, and I would like those node scripts to be included as a part of the entry point, and not be dependent on the vendors chunk. So for example, my build would create the following:

  • vendors.js
  • script-1.js (no node modules, dependent on vendors.js for it to run)
  • script-2.js (no node modules, dependent on vendors.js for it to run)
  • script-3.js (necessary node modules included, can run independently of vendors.js)

How can I go about configuring this in webpack?

pzhx
  • 11
  • 1

0 Answers0