diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-11 16:02:01 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-11 16:02:01 +0200 |
| commit | cf4098b20dadcd378ef2730f32f70e327ab262b4 (patch) | |
| tree | 7683817932967b083fd3447649f127d461d802fb /webpack.config.site.js | |
| parent | 52531fbc8d3531a7941ad9c6c79a1e353d35f2fa (diff) | |
making sure cursors and css are good in the main site
Diffstat (limited to 'webpack.config.site.js')
| -rw-r--r-- | webpack.config.site.js | 55 |
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", + ], } } ] - } -} + }, +}; |
