search

Home  >  Q&A  >  body text

How does webpack extract public packages?

// ...
entry: {
    pageA: './src/pages/pageA.js',
    pageB: './src/pages/pageB.js',
    pageC: './src/pages/pageC.js',
    pageD: './src/pages/pageD.js',
    vendor: ['lodash', 'moment', 'marked'],
},
plugins: {
    new webpack.optimize.CommonsChunkPlugin({
        name: ['vendor', 'manifest'],
    })
}
// ...

According to the official webpack2 documentation, through the above configuration, the third-party library can be extracted to vendor.js. So how to extract the custom public packages used in pageA, pageB, pageC, and pageD?

高洛峰高洛峰2774 days ago600

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 13:28:09

    /a/11...

    reply
    0
  • Cancelreply