Skip to content

Commit

Permalink
Fix building minified js
Browse files Browse the repository at this point in the history
  • Loading branch information
raven-wing authored Oct 4, 2022
1 parent 0dcad90 commit f5c88b3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
37 changes: 19 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@problematy/goodmap",
"version": "0.1.4",
"version": "0.1.5",
"description": "Fronted scripts for map ",
"main": "dist/map.js",
"scripts": {
Expand All @@ -26,6 +26,7 @@
"babel-jest": "^28.1.1",
"babel-loader": "^8.2.5",
"jest": "^28.1.1",
"terser-webpack-plugin": "^5.3.6",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
Expand Down
20 changes: 16 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
const webpack = require('webpack');
module.exports = {
const TerserPlugin = require('terser-webpack-plugin');


module.exports = (env, argv) => {
const IS_PROD = argv.mode == 'production'

return {
devtool: 'source-map',
entry: './src/map.js',
entry: "./src/map.js",
output: {
path: __dirname + '/dist',
filename: 'map.js',
filename: IS_PROD ? 'map.min.js' : 'map.js',
},
resolve: {
extensions: ['.js', '.jsx', '.css']
},

optimization: {
minimize: IS_PROD,
minimizer: [
new TerserPlugin({ parallel: true })
]
},
module: {
rules: [
{
Expand All @@ -19,4 +30,5 @@ module.exports = {
}
]
}
}
};

0 comments on commit f5c88b3

Please sign in to comment.