Skip to content

Chore/minimize based on NODE_ENV #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"manifest:dev": "cross-env NODE_ENV=dev node ./deploy/generate-manifest.js",
"manifest:prod": "cross-env NODE_ENV=prod node ./deploy/generate-manifest.js",
"release:dev": "npm run build && npm run manifest:dev && node ./deploy/zip.js",
"release:prod": "npm run build && npm run manifest:prod && node ./deploy/zip.js",
"manifest:dev": "cross-env NODE_ENV=development node ./deploy/generate-manifest.js",
"manifest:prod": "cross-env NODE_ENV=production node ./deploy/generate-manifest.js",
"release:dev": "cross-env NODE_ENV=development npm run build && npm run manifest:dev && node ./deploy/zip.js",
"release:prod": "cross-env NODE_ENV=production npm run build && npm run manifest:prod && node ./deploy/zip.js",
"clear": "node ./deploy/clear.js",
"deploy:dev": "npm run clear && npm run release:dev && node ./deploy/unzip.js",
"deploy:prod": "npm run clear && npm run release:prod && node ./deploy/unzip.js"
Expand All @@ -23,7 +23,7 @@
},
"keywords": [],
"author": "Haolin Zhong",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler"
},
Expand Down
7 changes: 3 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@




console.log(`[${process.env.NODE_ENV}]webpack.config.js loaded`);
module.exports = {
entry: {
popup: {
Expand Down Expand Up @@ -54,13 +54,12 @@ module.exports = {
}
]
},
mode: 'production',
// 开发模式,代码不会被压缩
// mode: 'development',
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
// 生成源码映射,方便调试
devtool: 'source-map',
// 关闭代码最小化
optimization: {
minimize: false
minimize: process.env.NODE_ENV === 'production'
}
}