diff --git a/config/webpack.config.js b/config/webpack.config.js index 3bd9387a3e..18710dd8a9 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -26,8 +26,8 @@ module.exports = function (env, argv) { output: { path: getPath('frontend/dist/app'), publicPath: '/app/', - assetModuleFilename: './assets/[hash][ext][query]', - filename: '[name].[contenthash].js', + assetModuleFilename: devMode ? './assets/[name][ext]' : './assets/[hash][ext][query]', + filename: devMode ? '[name].js' : '[name].[contenthash].js', clean: true }, module: { @@ -58,10 +58,7 @@ module.exports = function (env, argv) { test: /\.css$/i, include: getPath('frontend/src'), use: [ - { - loader: devMode ? 'style-loader' : MiniCssExtractPlugin.loader, - options: {} - }, + MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { importLoaders: 1 } @@ -69,29 +66,30 @@ module.exports = function (env, argv) { { loader: 'postcss-loader', options: { + sourceMap: false, postcssOptions: { config: path.resolve(__dirname, 'postcss.config.js') } } } ] - }, { + }, + { test: /\.css$/i, exclude: getPath('frontend/src'), use: [ - { - loader: 'style-loader', - options: {} - }, + devMode ? 'style-loader' : MiniCssExtractPlugin.loader, { loader: 'css-loader', - options: { importLoaders: 1 } + options: { importLoaders: 1, sourceMap: false } } ] - }, { + }, + { test: /\.scss$/, + exclude: /node_modules/, use: [ - devMode ? 'style-loader' : MiniCssExtractPlugin.loader, + MiniCssExtractPlugin.loader, { loader: 'css-loader', options: { import: true, url: true } @@ -102,7 +100,20 @@ module.exports = function (env, argv) { additionalData: '@use "@/ui-components/stylesheets/ff-colors.scss" as *;@use "@/ui-components/stylesheets/ff-utility.scss" as *;' } } - + ] + }, + { + test: /\.scss$/, + include: /node_modules/, + use: [ + devMode ? 'style-loader' : MiniCssExtractPlugin.loader, + { + loader: 'css-loader', + options: { import: true, url: true } + }, + { + loader: 'sass-loader' + } ] }, { @@ -135,9 +146,7 @@ module.exports = function (env, argv) { filename: getPath('frontend/dist-setup/setup.html'), chunks: ['setup'] }), - new MiniCssExtractPlugin({ - filename: '[name].[contenthash].css' - }), + new MiniCssExtractPlugin({ filename: devMode ? '[name].css' : '[name].[contenthash].css' }), new CopyPlugin({ patterns: [ { from: getPath('frontend/public'), to: '..' } @@ -177,7 +186,8 @@ module.exports = function (env, argv) { historyApiFallback: true }, watchOptions: { - poll: 1000 + poll: 1000, + ignored: [getPath('frontend/dist/**'), '**/node_modules/**'] }, resolve: { extensions: ['.ts', '.js', '.vue', '.json'],