summaryrefslogtreecommitdiff
path: root/webpack.config.site.js
diff options
context:
space:
mode:
Diffstat (limited to 'webpack.config.site.js')
-rw-r--r--webpack.config.site.js55
1 files changed, 35 insertions, 20 deletions
diff --git a/webpack.config.site.js b/webpack.config.site.js
index 8a62c75..07a48c8 100644
--- a/webpack.config.site.js
+++ b/webpack.config.site.js
@@ -2,12 +2,12 @@ require('dotenv').config()
const webpack = require('webpack')
const path = require('path')
+const TerserPlugin = require('terser-webpack-plugin')
+
-// print stack-trace of deprecations in webpack plugins, if something causes this
-// process.traceDeprecation = true
module.exports = {
- mode: "development",
+ mode: "production",
entry: {
main: './frontend/site/index.js'
},
@@ -15,7 +15,29 @@ module.exports = {
path: path.resolve(__dirname, 'static/js/dist'),
filename: 'bundle.js'
},
- devtool: 'cheap-module-eval-source-map',
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': JSON.stringify("production"),
+ // 'process.env.S3_HOST': JSON.stringify(process.env.S3_HOST || ""),
+ // 'process.env.API_HOST': JSON.stringify(process.env.API_HOST || ""),
+ '__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
+ }),
+ new TerserPlugin(),
+ new webpack.optimize.AggressiveMergingPlugin(),
+ // new Visualizer({
+ // filename: './statistics.html'
+ // })
+ ],
+ optimization: {
+ minimize: true,
+ minimizer: [new TerserPlugin({
+ terserOptions: {
+ compress: {
+ // drop_console: true,
+ }
+ }
+ })],
+ },
resolve: {
alias: {
// "react": "preact/compat",
@@ -23,12 +45,7 @@ module.exports = {
// "react-dom": "preact/compat",
}
},
- plugins: [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': '"development"',
- '__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
- }),
- ],
+ devtool: 'cheap-module-source-map',
module: {
rules: [
{
@@ -39,16 +56,14 @@ module.exports = {
test: /\.js$/,
// include: path.resolve(__dirname, 'client'),
exclude: /(node_modules|bower_components|build)/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- plugins: [
- "@babel/plugin-transform-runtime",
- ],
- }
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-react'],
+ plugins: [
+ "@babel/plugin-transform-runtime",
+ ],
}
}
]
- }
-}
+ },
+};