Skip to content

Commit

Permalink
Fix webpack (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Slipchenko authored Aug 5, 2022
1 parent 02a8ccf commit 00520d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"scripts": {
"dev": "webpack --watch --mode development",
"dist": "webpack --mode production",
"dist": "NODE_OPTIONS=--max-old-space-size=8192 webpack --mode production",
"lint:eslint": "eslint --ext .ts,.tsx,.js --max-warnings 0 .",
"lint:eslint:fix": "eslint --fix --ext .ts,.tsx,.js .",
"lint:prettier": "prettier . --check",
Expand Down
2 changes: 1 addition & 1 deletion scripts/PlatformPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = class PlatformPlugin {
if (this.performance) {
compiler.hooks.done.tap('PerformanceSize', ({ compilation }) => {
Object.entries(compilation.assets).forEach(([name, source]) => {
if (source.size() > MAX_ASSET_SIZE) {
if (name.endsWith('.js') && source.size() > MAX_ASSET_SIZE) {
throw `${name} is larger than 4 MB`;
}
});
Expand Down
9 changes: 2 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ module.exports = (_, { mode }) => {
stream: require.resolve('stream-browserify'),
},
},
devtool: !isProduction && 'inline-source-map',
devtool: isProduction ? 'source-map' : 'inline-source-map',
stats: 'errors-warnings',
performance: {
maxAssetSize: 4000000,
},
optimization: {
minimizer: ['...', new CssMinimizerPlugin()],
splitChunks: {
Expand Down Expand Up @@ -205,9 +202,7 @@ module.exports = (_, { mode }) => {
}),
new MiniCssExtractPlugin(),
new PlatformPlugin({
platforms: isProduction
? ['chrome', 'firefox', 'opera', 'edge']
: ['chrome', 'firefox'],
platforms: ['chrome', 'firefox', 'opera', 'edge'],
version,
clear: isProduction,
compress: isProduction,
Expand Down

0 comments on commit 00520d0

Please sign in to comment.