Webpack SplitChunksPlugin - 完全排除一个入口点

koo*_*osa 6 webpack webpacker splitchunksplugin

我通过 Rails + Webpacker 将 SplitChunksPlugin 与 Webpack 4 结合使用。

我有一个应用程序,我想将其拆分为多个块 - 除了一个面向公众的入口点,我希望成为一个独立的单个文件。

当我之前使用 CommonsChunkVendor 时,我可以这样做:

var adminEntries = Object.keys(environment.entry).filter(function(e) { return e !== 'app' });

environment.plugins.append(
  'CommonsChunkVendor',
  new webpack.optimize.CommonsChunkPlugin({
    name: 'vendor',
    chunks: adminEntries,
    minChunks: (module) => {
      // this assumes your vendor imports exist in the node_modules directory
      return module.context && module.context.indexOf('node_modules') !== -1
    }
  })
)
Run Code Online (Sandbox Code Playgroud)

这将排除“app”入口点被分割。

如何使用 SplitChunksPlugin 实现此目的?