materio-d9/build/webpack.config.prod.js

97 lines
2.4 KiB
JavaScript

'use strict'
const webpack = require('webpack')
const { merge } = require('webpack-merge')
const baseConfig = require('./webpack.config.base')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const TerserPlugin = require("terser-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");
require('dotenv').config();
console.log(process.env);
module.exports = merge(baseConfig, {
mode: 'production',
module: {
rules: [
{
test: /\.css?$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '',
},
},
'css-loader'
]
}, {
test: /\.scss?$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '',
},
},
'css-loader',
'sass-loader'
]
}, {
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 5000
}
}
]
}
]
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true,
test: /\.(js|vue)$/,
// extractComments: true
terserOptions: {
compress: {
// drop_console: true,
pure_funcs: [
'console.log',
'console.info',
'console.debug'
// 'console.warn'
]
},
},
})
],
},
devtool: 'source-map', // Ensure source maps are generated
plugins: [
sentryWebpackPlugin({
// Sentry-specific options
org: "figures-libres",
project: "materio.com",
authToken: process.env.SENTRY_AUTH_TOKEN,
url: "https://frontlog.figli.io",
release: process.env.RELEASE,
// urlPrefix: '~/', // Adjust based on your deployment setup
// include: './dist', // Adjust based on your output directory
// ignore: ['node_modules', 'webpack.config.js', 'build'],
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new BundleAnalyzerPlugin({
'analyzerMode': 'static'
})
]
})