adambullmer / vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.0
GNU Lesser General Public License v3.0
426 stars 76 forks source link

how to support common chunk (vendor) for background/popup/content/pages #77

Open ipluser opened 4 years ago

ipluser commented 4 years ago

The google extension has multiple content entries and customization pages, it also has a popup and background script. So the output size is too large, I want to split chunks to reduce size of the bundle script, then I adjust vue.config.js:

configureWebpack: {
    optimization: {
      splitChunks: {
        cacheGroups: {
          vendors: {
            test: /[\\/]node_modules[\\/]/,
            name: 'vendors',
            chunks: 'all'
          }
        }
      }
    }
  },
  pages: {
    'popup/popup': {
      entry: 'src/popup/popup.js',
      title: 'Shop Eden',
      chunks: ['vendors', 'popup/popup']
    }
 }

Then the pages, popup scripts is ok, but the background and content scripts doesn't work, How to support split chunks feature for all scripts? (only chainWebpack?)

Yangjia23 commented 2 years ago

哥,这问题解决了嘛?