Skip to content

Commit

Permalink
feat: 增加是否添加 polyfill 的开关配置
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhi107 committed Dec 4, 2019
1 parent 5c8b6e1 commit bcb7086
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"license": "MIT",
"dependencies": {
"@babel/core": "^7.4.5",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.4.5",
"@loadable/babel-plugin": "^5.10.0",
"@loadable/component": "^5.10.1",
Expand Down
3 changes: 3 additions & 0 deletions src/utils/defaultEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default {
// 是否可以将请求代理到数据文件
DACE_PROXY_TO_FILE: 'false',

// 是否加 polyfill
DACE_POLYFILL: 'false',

// 编译产物对外服务访问使用的 URL
DACE_PUBLIC_PATH: '/',

Expand Down
4 changes: 4 additions & 0 deletions src/webpack/config/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default ({
DACE_LONG_TERM_CACHING,
DACE_LONG_TERM_CACHING_LENGTH,
// DACE_PATH_ROOT,
DACE_POLYFILL,
DACE_PATH_BABEL_RC,
DACE_PATH_ESLINT_RC,
DACE_PATH_POSTCSS_RC,
Expand Down Expand Up @@ -390,6 +391,9 @@ export default ({
? DACE_PATH_CLIENT_ENTRY
: path.resolve(__dirname, '../../runtime/client.js')
];
if (DACE_POLYFILL === 'true') {
config.entry.unshift('@babel/polyfill');
}

config.output = {
path: DACE_PATH_CLIENT_DIST,
Expand Down

0 comments on commit bcb7086

Please sign in to comment.