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') 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,同时会带来更快的构建速度和更小的文件体积。