Multi-process packaging

First installation

npm i thread-loader -D
Copy the code

Then configure it in vue.config.js and put it in configureWebpack because it won’t be used in chainWebpack

configureWebpack: (config) = > {
    if (process.env.NODE_ENV === 'production') {
      config.module.rules.push({
        exclude: /node_modules/,
        include: /src/,
        test: /\.vue$/,
        use: [
          {
            loader: 'thread-loader'.options: {
              workers: 2 // Process 2}}, {loader: 'vue-loader'// Since it is a.vue file, vue-loader is used here}]})}}Copy the code

Let’s take a look at the maximum time before optimization: 197.5s with secondary packaging: 140.9s

After using thread-loader

Increased a lot of speed, happy hahahahaha.