Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mould-vuecli3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lhfe
mould-vuecli3
Commits
290cf4a6
Commit
290cf4a6
authored
Aug 29, 2020
by
lipengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 生产环境打包去掉console
parent
629e31f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
vue.config.js
vue.config.js
+8
-14
No files found.
vue.config.js
View file @
290cf4a6
...
@@ -23,21 +23,15 @@ module.exports = {
...
@@ -23,21 +23,15 @@ module.exports = {
},
},
chainWebpack
:
(
config
)
=>
{
chainWebpack
:
(
config
)
=>
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
// 按需引入lodash
config
.
plugin
(
'lodashReplace'
).
use
(
new
LodashModuleReplacementPlugin
())
config
.
plugin
(
'lodashReplace'
).
use
(
new
LodashModuleReplacementPlugin
())
// 生产环境打包去掉console
// // 去除 console.log
config
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
(
config
)
=>
{
// config.plugin('uglify').tap(([options]) => {
config
.
optimization
.
minimizer
(
'terser'
).
tap
((
options
)
=>
{
// return [
options
[
0
].
terserOptions
.
compress
.
drop_console
=
true
// Object.assign(options, {
return
options
// uglifyOptions: {
})
// compress: {
})
// drop_console: true,
// pure_funcs: ['console.log']
// }
// }
// })
// ]
// })
}
}
config
.
module
config
.
module
.
rule
(
'eslint'
)
.
rule
(
'eslint'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment