@electrojet/core
Version:
Build scripts for use with create-electrojet
57 lines (54 loc) • 1.33 kB
JavaScript
const webpack = require('webpack');
const WebpackBar = require('webpackbar');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const commonPaths = require("./common-paths");
module.exports = {
mode: 'production',
devtool: 'source-map',
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.jsx?$/,
use: {
loader: 'babel-loader',
},
exclude: /(node_modules|dist|build-utils|webpack.config.js)/,
},
],
},
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
}),
new OptimizeCSSAssetsPlugin({}),
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
DEBUG: false,
}),
new WebpackBar({
profile: true,
name: 'Electrojet',
}),
new CopyWebpackPlugin([{
from: 'public/*',
to: commonPaths.appDist
}])
],
};