Skip to content

Commit

Permalink
Update build chain
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Jul 11, 2023
1 parent 9d4f5de commit 819ac1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
19 changes: 0 additions & 19 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@jest/globals": "^29.6.1",
"babel-jest": "^29.6.1",
"babel-loader": "^9.1.3",
"cross-env": "^7.0.3",
"css-loader": "^6.8.1",
"eslint": "^8.44.0",
"eslint-plugin-jest": "^27.2.2",
Expand Down
13 changes: 8 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');

const nodeEnv = process.env.NODE_ENV || 'development';
const mode = process.argv.includes('--mode=production') ?
'production' : 'development';
const libraryName = process.env.npm_package_name;


module.exports = {
mode: nodeEnv,
mode: mode,
resolve: {
alias: {
'@services': path.resolve(__dirname, 'src/scripts/services'),
Expand All @@ -15,7 +17,7 @@ module.exports = {
}
},
optimization: {
minimize: nodeEnv === 'production',
minimize: mode === 'production',
minimizer: [
new TerserPlugin({
terserOptions: {
Expand All @@ -36,7 +38,8 @@ module.exports = {
},
output: {
filename: `${libraryName}.js`,
path: path.resolve(__dirname, 'dist')
path: path.resolve(__dirname, 'dist'),
clean: true
},
target: ['browserslist'],
module: {
Expand Down Expand Up @@ -78,5 +81,5 @@ module.exports = {
stats: {
colors: true
},
...(nodeEnv !== 'production' && { devtool: 'eval-cheap-module-source-map' })
...(mode !== 'production' && { devtool: 'eval-cheap-module-source-map' })
};

0 comments on commit 819ac1f

Please sign in to comment.