From f19c1a5e3652469d9e25f626e98be1dd4db83f1b Mon Sep 17 00:00:00 2001 From: Serge Huber Date: Fri, 1 Mar 2024 06:24:33 +0100 Subject: [PATCH] BACKLOG-22440 Fix Webpack order --- webpack.config.js | 114 +++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 83678d1..727fb22 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,61 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = env => { let configs = [ + { + entry: './src/scss/styles.scss', + output: { + path: path.resolve(__dirname, 'css') + }, + module: { + rules: [ + { + test: /\.scss$/, + use: [ + MiniCssExtractPlugin.loader, + 'css-loader', + 'sass-loader' + ] + } + ] + }, + plugins: [ + new MiniCssExtractPlugin({ filename: '[name].css' }) + ] + }, + { + entry: { + main: './src/client' + }, + output: { + path: path.resolve(__dirname, 'javascript') + }, + resolve: { + mainFields: ['module', 'main'], + extensions: ['.mjs', '.js', '.jsx'] + }, + module: { + rules: [ + { + test: /\.jsx$/, + include: [path.join(__dirname, 'src/client')], + use: { + loader: 'babel-loader', + options: { + presets: [ + ['@babel/preset-env', { modules: false, targets: { safari: '7', ie: '10' } }], + '@babel/preset-react' + ], + plugins: [ + 'styled-jsx/babel' + ] + } + } + } + ] + }, + devtool: 'inline-source-map', + mode: 'development' + }, { entry: { main: path.resolve(__dirname, 'src/server') @@ -57,7 +112,7 @@ module.exports = env => { plugins: [ new ExtraWatchWebpackPlugin({ files: [ - 'src/**/*', + 'src/server/**/*', 'images/**/*', 'css/**/*', 'javascript/**/*', @@ -72,61 +127,6 @@ module.exports = env => { ], devtool: 'inline-source-map', mode: 'development' - }, - { - entry: './src/scss/styles.scss', - output: { - path: path.resolve(__dirname, 'css') - }, - module: { - rules: [ - { - test: /\.scss$/, - use: [ - MiniCssExtractPlugin.loader, - 'css-loader', - 'sass-loader' - ] - } - ] - }, - plugins: [ - new MiniCssExtractPlugin({ filename: '[name].css' }) - ] - }, - { - entry: { - main: './src/client' - }, - output: { - path: path.resolve(__dirname, 'javascript') - }, - resolve: { - mainFields: ['module', 'main'], - extensions: ['.mjs', '.js', '.jsx'] - }, - module: { - rules: [ - { - test: /\.jsx$/, - include: [path.join(__dirname, 'src/client')], - use: { - loader: 'babel-loader', - options: { - presets: [ - ['@babel/preset-env', { modules: false, targets: { safari: '7', ie: '10' } }], - '@babel/preset-react' - ], - plugins: [ - 'styled-jsx/babel' - ] - } - } - } - ] - }, - devtool: 'inline-source-map', - mode: 'development' } ]; @@ -137,7 +137,7 @@ module.exports = env => { }); if (env.deploy) { - let config = configs[0]; + let config = configs[configs.length - 1]; if (!config.plugins) { config.plugins = []; }