Commit 80ce8fe4 authored by 信鑫-King's avatar 信鑫-King Committed by 陈帅

Tweak console dev (#4133)

* 💄 allow use console in dev, auto remove in production.

* fix: use uglifyJSOptions

* fix: config.ts using NODE_ENV identify isProd
parent db2c01c6
......@@ -7,7 +7,7 @@ import webpackPlugin from './plugin.config';
const { pwa, primaryColor } = defaultSettings;
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST } = process.env;
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST, NODE_ENV } = process.env;
const plugins: IPlugin[] = [
[
......@@ -67,6 +67,17 @@ if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
},
]);
}
const uglifyJSOptions = NODE_ENV === 'production'
? {
uglifyOptions: {
// remove console.* except console.error
compress: {
drop_console: true,
pure_funcs: [ 'console.error' ],
},
},
}
: {};
export default {
// add for transfer to umi
......@@ -145,5 +156,6 @@ export default {
manifest: {
basePath: '/',
},
uglifyJSOptions,
chainWebpack: webpackPlugin,
} as IConfig;
......@@ -20,15 +20,6 @@ rules:
no-bitwise: true
no-conditional-assignment: true
no-consecutive-blank-lines: true
no-console:
- true
- debug
- info
- log
- time
- timeEnd
- trace
- warn
no-construct: true
no-debugger: true
no-duplicate-variable: true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment