浏览代码

chore: extract big vendor chunks (#649)

tophf 6 年之前
父节点
当前提交
d97f430543
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      scripts/plaid.conf.js

+ 13 - 0
scripts/plaid.conf.js

@@ -46,6 +46,15 @@ exports.pages = {
   },
 };
 
+const splitVendor = name => ({
+  [name]: {
+    test: new RegExp(`node_modules[/\\\\]${name}`),
+    name: `public/lib/${name}`,
+    chunks: 'all',
+    priority: 100,
+  },
+});
+
 exports.devServer = false;
 exports.devtool = isProd ? false : 'inline-source-map';
 exports.optimization = {
@@ -55,6 +64,7 @@ exports.optimization = {
       common: {
         name: 'common',
         minChunks: 2,
+        enforce: true,
         chunks(chunk) {
           return ![
             'browser',
@@ -62,6 +72,9 @@ exports.optimization = {
           ].includes(chunk.name);
         },
       },
+      ...splitVendor('codemirror'),
+      ...splitVendor('tldjs'),
+      ...splitVendor('vue'),
     },
   },
 };