This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
augie/webapp/assets/webpack.config.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-29 17:55:52 +13:00
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => ({
optimization: {
minimizer: [
new TerserPlugin({ cache: true, parallel: true, sourceMap: false }),
new OptimizeCSSAssetsPlugin({})
]
},
entry: {
'./js/app.js': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
},
output: {
filename: 'app.js',
path: path.resolve(__dirname, '../priv/static/js')
},
module: {
2019-12-02 18:42:51 +13:00
rules: [{
2019-11-29 17:55:52 +13:00
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
2019-12-02 18:42:51 +13:00
test: /\.s?css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
2019-11-29 17:55:52 +13:00
}
]
},
plugins: [
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
2019-11-29 17:55:52 +13:00
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
]
});