Skip to content

Commit 2aaacda

Browse files
authored
Merge pull request #120 from SpringRoll/feature/184506946-drop_consoles-main
Feature/184506946 drop consoles - Main
2 parents cdc9368 + 7d551b1 commit 2aaacda

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.1] - 2024-06-11
9+
10+
### Changed
11+
12+
- added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
13+
- added TerserPlugin options to webpack to maintain function names in debug builds
14+
15+
- Pixi: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
16+
- Pixi: added TerserPlugin options to webpack to maintain function names in debug builds
17+
18+
- Phaser: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
19+
- Phaser: added TerserPlugin options to webpack to maintain function names in debug builds
20+
21+
- CreateJS: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
22+
- CreateJS: added TerserPlugin options to webpack to maintain function names in debug builds
23+
824
## [2.0.0] - 2024-05-09
925

1026
### Changed

package-lock.json

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "springroll-seed",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
@@ -21,12 +21,12 @@
2121
"eslint-webpack-plugin": "^3.2.0",
2222
"html-webpack-plugin": "^5.5.0",
2323
"mini-css-extract-plugin": "^2.6.1",
24+
"source-map-loader": "^1.0.0",
25+
"springroll": "^2.4.4",
2426
"style-loader": "^3.3.1",
27+
"terser-webpack-plugin": "^5.3.10",
2528
"webpack": "^5.75.0",
2629
"webpack-cli": "^4.10.0",
27-
"webpack-dev-server": "^4.11.1",
28-
"source-map-loader": "^1.0.0",
29-
"springroll": "^2.4.4"
30-
},
31-
"dependencies": {}
30+
"webpack-dev-server": "^4.11.1"
31+
}
3232
}

webpack.config.js

+19-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ const CopyPlugin = require('copy-webpack-plugin');
55
const HtmlConfig = require(path.join(__dirname, 'html.config'));
66
const CleanPlugin = require('clean-webpack-plugin');
77
const ESLintPlugin = require('eslint-webpack-plugin');
8+
const TerserPlugin = require('terser-webpack-plugin');
89

910
const deploy = path.join(__dirname, 'deploy');
10-
const isProduction = process.env.NODE_ENV == "production";
1111

12-
// keep the env param to be explicit, eslint disable should be removed when template is in use
13-
// eslint-disable-next-line no-unused-vars
1412
module.exports = (env) => {
13+
const isProduction = !!env.production;
14+
1515
const plugins = [
1616
new CleanPlugin.CleanWebpackPlugin(),
1717
new HtmlWebpackPlugin(HtmlConfig),
@@ -27,8 +27,6 @@ module.exports = (env) => {
2727
return {
2828
stats: 'errors-only',
2929

30-
mode: isProduction ? 'production':'development',
31-
3230
devServer: {
3331
open: true,
3432
client: { overlay: true },
@@ -109,6 +107,21 @@ module.exports = (env) => {
109107
use: ['source-map-loader'],
110108
},
111109
]
112-
}
110+
},
111+
optimization: {
112+
minimize: true,
113+
minimizer: [
114+
new TerserPlugin({
115+
terserOptions: {
116+
mangle: {
117+
keep_fnames: isProduction ? false : true,
118+
},
119+
compress: {
120+
drop_console: isProduction ? ['log', 'info']: false,
121+
},
122+
},
123+
}),
124+
],
125+
}
113126
};
114127
};

0 commit comments

Comments
 (0)