mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 11:12:15 +03:00
02ad4c8f5e
* update js deps * Update development command Co-authored-by: happysalada <raphael@megzari.com>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
const path = require('path');
|
|
const glob = require('glob');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
const CssMinimizerWebpackPlugin = require('css-minimizer-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
module.exports = (env, options) => ({
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin(),
|
|
new CssMinimizerWebpackPlugin()
|
|
]
|
|
},
|
|
entry: {
|
|
'app': ['./js/app.js'],
|
|
'dashboard': ['./js/dashboard/mount.js'],
|
|
'embed.host': ['./js/embed.host.js'],
|
|
'embed.content': ['./js/embed.content.js']
|
|
},
|
|
output: {
|
|
filename: '[name].js',
|
|
path: path.resolve(__dirname, '../priv/static/js')
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader'
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
|
|
}
|
|
]
|
|
},
|
|
externals: { moment: 'moment' },
|
|
plugins: [
|
|
new MiniCssExtractPlugin({filename: '../css/[name].css'}),
|
|
new CopyWebpackPlugin({patterns: [{from: 'static/', to: '../' }]}),
|
|
]
|
|
});
|