Skip to content

Commit

Permalink
feat: 支持编译时不压缩源码
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhi107 committed Dec 4, 2019
1 parent 9d6fefc commit fff23ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/defaultEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export default {
// 是否启用服务器端渲染
DACE_SSR: 'true',

// 编译时是否压缩文件
DACE_MINIMIZE: 'true',

// 输出的 script 标签是否使用 crossorigin 属性
DACE_SCRIPT_CROSSORIGIN: 'true',

Expand Down
3 changes: 3 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_MINIMIZE,
DACE_POLYFILL,
DACE_PATH_BABEL_RC,
DACE_PATH_ESLINT_RC,
Expand Down Expand Up @@ -367,6 +368,8 @@ export default ({
})
];

config.optimization = { minimize: DACE_MINIMIZE === 'true' };

if (IS_DEV) {
config.watch = true;
config.entry.unshift('webpack/hot/poll?300');
Expand Down

0 comments on commit fff23ea

Please sign in to comment.