Skip to content

Commit 99dae0a

Browse files
authored
Merge pull request #123 from SpringRoll/feature/184506946-drop_consoles-createjs
Feature/184506946 drop consoles - CreateJS
2 parents 0dd2339 + 2ddd702 commit 99dae0a

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
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

+2-1
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": {
@@ -26,6 +26,7 @@
2626
"source-map-loader": "^1.0.0",
2727
"springroll": "^2.6.0",
2828
"style-loader": "^3.3.1",
29+
"terser-webpack-plugin": "^5.3.10",
2930
"webpack": "^5.75.0",
3031
"webpack-cli": "^4.10.0",
3132
"webpack-dev-server": "^4.11.1"

webpack.config.js

+19-4
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),
@@ -131,6 +131,21 @@ module.exports = (env) => {
131131
use: ['source-map-loader'],
132132
},
133133
]
134-
}
134+
},
135+
optimization: {
136+
minimize: true,
137+
minimizer: [
138+
new TerserPlugin({
139+
terserOptions: {
140+
mangle: {
141+
keep_fnames: isProduction ? false : true,
142+
},
143+
compress: {
144+
drop_console: isProduction ? ['log', 'info']: false,
145+
},
146+
},
147+
}),
148+
],
149+
}
135150
};
136151
};

0 commit comments

Comments
 (0)