Skip to content

Commit e14c914

Browse files
authored
Merge pull request #121 from SpringRoll/feature/184506946-drop_consoles-pixi
Feature/184506946 drop consoles - Pixi
2 parents 2608d8e + 9a930db commit e14c914

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ 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+
9+
## [2.1.0] - unreleased
10+
11+
### Changed
12+
13+
- Pixi: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
14+
- Pixi: added TerserPlugin options to webpack to maintain function names in debug builds
15+
16+
- Phaser: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
17+
- Phaser: added TerserPlugin options to webpack to maintain function names in debug builds
18+
19+
- CreateJS: added TerserPlugin options to webpack to drop `console.log` and `console.info` in production builds
20+
- CreateJS: added TerserPlugin options to webpack to maintain function names in debug builds
21+
822
## [2.0.0] - 2024-05-09
923

1024
### Changed

package-lock.json

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

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
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": "^4.0.1",
25+
"springroll": "^2.6.0",
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": "^4.0.1",
29-
"springroll": "^2.6.0"
30+
"webpack-dev-server": "^4.11.1"
3031
},
3132
"dependencies": {
3233
"@pixi/sound": "^6.0.0",

webpack.config.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const HtmlConfig = require(path.join(__dirname, 'html.config'));
66
const CleanPlugin = require('clean-webpack-plugin');
77
const os = require('os');
88
const ESLintPlugin = require('eslint-webpack-plugin');
9+
import TerserPlugin from 'terser-webpack-plugin';
910

1011
const deploy = path.join(__dirname, 'deploy');
11-
const isProduction = process.env.NODE_ENV == "production";
1212

13-
// keep the env param to be explicit, eslint disable should be removed when template is in use
14-
// eslint-disable-next-line no-unused-vars
1513
module.exports = (env) => {
14+
const isProduction = !!env.production;
15+
1616
const plugins = [
1717
new CleanPlugin.CleanWebpackPlugin(),
1818
new HtmlWebpackPlugin(HtmlConfig),
@@ -133,6 +133,21 @@ module.exports = (env) => {
133133
use: ['source-map-loader'],
134134
},
135135
]
136-
}
136+
},
137+
optimization: {
138+
minimize: true,
139+
minimizer: [
140+
new TerserPlugin({
141+
terserOptions: {
142+
mangle: {
143+
keep_fnames: isProduction ? false : true,
144+
},
145+
compress: {
146+
drop_console: isProduction ? ['log', 'info']: false,
147+
},
148+
},
149+
}),
150+
],
151+
}
137152
};
138153
};

0 commit comments

Comments
 (0)