You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/assets/webpack.config.js

50 lines
1.4 KiB
JavaScript

7 years ago
const path = require('path');
const glob = require('glob');
const webpack = require('webpack');
7 years ago
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6 years ago
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerWebpackPlugin = require('css-minimizer-webpack-plugin');
7 years ago
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env, options) => ({
optimization: {
minimizer: [
6 years ago
new TerserPlugin(),
new CssMinimizerWebpackPlugin()
7 years ago
]
},
entry: {
'app': ['./js/app.js'],
'dashboard': ['./js/dashboard/mount.js'],
'embed.host': ['./js/embed.host.js'],
'embed.content': ['./js/embed.content.js']
7 years ago
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../priv/static/js')
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
7 years ago
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
}
]
},
externals: { moment: 'moment' },
7 years ago
plugins: [
new MiniCssExtractPlugin({filename: '../css/[name].css'}),
6 years ago
new CopyWebpackPlugin({patterns: [{from: 'static/', to: '../' }]}),
new webpack.ProvidePlugin({
ResizeObserver: ['@juggle/resize-observer', 'ResizeObserver'] // https://caniuse.com/?search=ResizeObserver
})
7 years ago
]
});