Add minification

This commit is contained in:
schmelczerandras 2020-10-07 14:13:22 +02:00
parent b3da27e73b
commit d34f25295c
14 changed files with 142 additions and 94 deletions

48
shared/webpack.config.js Normal file
View file

@ -0,0 +1,48 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const PATHS = {
entryPoint: path.resolve(__dirname, 'src/main.ts'),
bundles: path.resolve(__dirname, 'lib'),
};
module.exports = (env, argv) => ({
entry: {
main: PATHS.entryPoint,
},
target: 'node',
output: {
filename: '[name].js',
path: PATHS.bundles,
libraryTarget: 'umd',
umdNamedDefine: true,
},
devtool: argv.mode === 'development' ? 'source-map' : false,
watchOptions: {
poll: true,
ignored: /node_modules/
},
optimization: {
minimize: false,
},
plugins: [
new CleanWebpackPlugin({
protectWebpackAssets: false,
cleanAfterEveryBuildPatterns: [],
}),
],
module: {
rules: [
{
test: /\.ts$/,
use: {
loader: 'ts-loader',
},
exclude: /node_modules/,
}
],
},
resolve: {
extensions: ['.ts', '.js'],
},
});