Skip to content

Commit 19e0569

Browse files
shigmaulivz
authored andcommitted
feat($core): functional siteConfig.evergreen (#1489)
1 parent cc193d5 commit 19e0569

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/@vuepress/core/lib/node/webpack/createBaseConfig.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ module.exports = function createBaseConfig (context, isServer) {
127127
.loader('pug-plain-loader')
128128
.end()
129129

130-
if (!siteConfig.evergreen) {
130+
const evergreen = typeof siteConfig.evergreen === 'function'
131+
? siteConfig.evergreen()
132+
: siteConfig.evergreen
133+
if (!evergreen) {
131134
const libDir = path.join(__dirname, '..')
132135
config.module
133136
.rule('js')

packages/docs/docs/config/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ module.exports = {
356356

357357
### evergreen
358358

359-
- Type: `boolean`
359+
- Type: `boolean | Function`
360360
- Default: `false`
361361

362362
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.

packages/docs/docs/zh/config/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ module.exports = {
348348

349349
### evergreen
350350

351-
- 类型: `boolean`
351+
- 类型: `boolean | Function`
352352
- 默认值: `false`
353353

354354
如果你的对象只有那些 “常青树” 浏览器,你可以将其设置成 `true`,这将会禁止 ESNext 到 ES5 的转译以及对 IE 的 polyfills,同时会带来更快的构建速度和更小的文件体积。

0 commit comments

Comments
 (0)