mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 01:22:15 +03:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
|
const path = require('path');
|
||
|
const glob = require('glob');
|
||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||
|
const DefinePlugin = require('webpack').DefinePlugin;
|
||
|
|
||
|
module.exports = (env, options) => ({
|
||
|
optimization: {
|
||
|
minimizer: [
|
||
|
new UglifyJsPlugin({ cache: true, parallel: true, sourceMap: false }),
|
||
|
new OptimizeCSSAssetsPlugin({})
|
||
|
]
|
||
|
},
|
||
|
entry: {
|
||
|
'app': ['./js/app.js'],
|
||
|
'p': ['./js/p.js'],
|
||
|
'analytics': ['./js/plausible.js'],
|
||
|
'plausible': ['./js/plausible.js']
|
||
|
},
|
||
|
output: {
|
||
|
filename: '[name].js',
|
||
|
path: path.resolve(__dirname, '../priv/static/js')
|
||
|
},
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.js$/,
|
||
|
exclude: /node_modules/,
|
||
|
use: {
|
||
|
loader: 'babel-loader'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
test: /\.css$/,
|
||
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
plugins: [
|
||
|
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
||
|
new CopyWebpackPlugin([{ from: 'static/', to: '../' }]),
|
||
|
new DefinePlugin({
|
||
|
"BASE_URL": JSON.stringify(process.env.BASE_URL || "http://localtest.me:8000")
|
||
|
}),
|
||
|
]
|
||
|
});
|