flip-cohen/webpack.config.js

50 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2022-05-02 16:30:13 +02:00
const webpack = require('webpack');
const path = require('path');
const srcPath = path.join(__dirname, 'src');
const srcJsPath = path.join(srcPath, 'js');
const destPath = path.join(__dirname, 'dist');
const destJsPath = path.join(destPath, 'js');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const env = process.env.NODE_ENV || 'production';
const config = {
watch: env !== 'production',
entry: {
"shared": srcJsPath + '/shared',
},
output: {
path: destJsPath,
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}
]
},
stats: {
colors: true
},
plugins: []
}
if (env === 'production') {
config.plugins.push(
new UglifyJsPlugin()
)
}
module.exports = config;