From a542ad2485768a8cf7f5abc3a130dcef368d1233 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Fri, 29 Mar 2019 18:27:38 +0800 Subject: [PATCH 1/2] Update createBaseConfig.js --- packages/@vuepress/core/lib/node/webpack/createBaseConfig.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js index 1bbd5caff5..f90ba6ffea 100644 --- a/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js +++ b/packages/@vuepress/core/lib/node/webpack/createBaseConfig.js @@ -127,7 +127,10 @@ module.exports = function createBaseConfig (context, isServer) { .loader('pug-plain-loader') .end() - if (!siteConfig.evergreen) { + const evergreen = typeof siteConfig.evergreen === 'function' + ? siteConfig.evergreen() + : siteConfig.evergreen + if (!evergreen) { const libDir = path.join(__dirname, '..') config.module .rule('js') From 5fc74da6aecd0374578c9e3117d427ae3c709f62 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Fri, 29 Mar 2019 18:29:53 +0800 Subject: [PATCH 2/2] add docs --- packages/docs/docs/config/README.md | 2 +- packages/docs/docs/zh/config/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index 0dfe76dc76..88600862e5 100644 --- a/packages/docs/docs/config/README.md +++ b/packages/docs/docs/config/README.md @@ -356,7 +356,7 @@ module.exports = { ### evergreen -- Type: `boolean` +- Type: `boolean | Function` - Default: `false` Set to `true` if you are only targeting evergreen browsers. This will disable ES5 transpilation and polyfills for IE, and result in faster builds and smaller files. diff --git a/packages/docs/docs/zh/config/README.md b/packages/docs/docs/zh/config/README.md index 21956e7ada..20f863a3f2 100644 --- a/packages/docs/docs/zh/config/README.md +++ b/packages/docs/docs/zh/config/README.md @@ -348,7 +348,7 @@ module.exports = { ### evergreen -- 类型: `boolean` +- 类型: `boolean | Function` - 默认值: `false` 如果你的对象只有那些 “常青树” 浏览器,你可以将其设置成 `true`,这将会禁止 ESNext 到 ES5 的转译以及对 IE 的 polyfills,同时会带来更快的构建速度和更小的文件体积。