Skip to content

Commit 31b1e68

Browse files
authored
Merge pull request #122 from SpringRoll/feature/184506946-drop_consoles-phaser
Feature/184506946 drop consoles - Phaser
2 parents 758818a + d275d94 commit 31b1e68

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

CHANGELOG.md

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

1023
### Changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
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": {
@@ -24,7 +24,7 @@
2424
"source-map-loader": "^1.0.0",
2525
"springroll": "^2.4.4",
2626
"style-loader": "^3.3.1",
27-
"terser-webpack-plugin": "^5.3.6",
27+
"terser-webpack-plugin": "^5.3.10",
2828
"webpack": "^5.75.0",
2929
"webpack-cli": "^4.10.0",
3030
"webpack-dev-server": "^4.11.1"

webpack.config.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ const ESLintPlugin = require('eslint-webpack-plugin');
88
const TerserPlugin = require('terser-webpack-plugin');
99

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

1312
// keep the env param to be explicit, eslint disable should be removed when template is in use
1413
// eslint-disable-next-line no-unused-vars
1514
module.exports = (env) => {
15+
const isProduction = !!env.production;
16+
1617
const plugins = [
1718
new CleanPlugin.CleanWebpackPlugin(),
1819
new HtmlWebpackPlugin(HtmlConfig),
@@ -47,10 +48,21 @@ module.exports = (env) => {
4748
},
4849

4950
optimization: {
50-
minimizer: [new TerserPlugin({
51-
extractComments: true
52-
})]
53-
},
51+
minimize: true,
52+
minimizer: [
53+
new TerserPlugin({
54+
55+
terserOptions: {
56+
mangle: {
57+
keep_fnames: isProduction ? false : true,
58+
},
59+
compress: {
60+
drop_console: isProduction ? ['log', 'info']: false,
61+
},
62+
},
63+
}),
64+
],
65+
},
5466

5567
plugins,
5668

0 commit comments

Comments
 (0)