diff options
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/webpack.config.js b/webpack.config.js index 0cf69606..c94ca661 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const ESLintPlugin = require('eslint-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = (env, argv) => { @@ -12,7 +13,8 @@ module.exports = (env, argv) => { devtool: dev ? 'source-map' : false, entry: { 'scripts': [ - __dirname + '/src/main/assets/scripts.js' + __dirname + '/src/main/assets/scripts.js', + __dirname + '/src/main/assets/style.css' ] }, output: { @@ -28,6 +30,39 @@ module.exports = (env, argv) => { /\bwebpack\/buildin\b/ ], loader: 'babel-loader' + }, { + test: /\.(css)$/, + use: [ + { + loader: dev ? 'style-loader' : MiniCssExtractPlugin.loader, + }, + { + loader: 'css-loader', + options: { + sourceMap: true, + }, + }, + { + loader: 'postcss-loader', + options: { + postcssOptions: { + plugins: [ + [ + 'postcss-preset-env', + { + 'stage': 0 + }, + 'stylelint', + 'autoprefixer', + { + 'grid': true + } + ], + ], + }, + }, + }, + ], }] }, plugins: [ @@ -52,6 +87,8 @@ module.exports = (env, argv) => { failOnError: true, fix: false })); + } else { + config.plugins.push(new MiniCssExtractPlugin()); } config.optimization = { minimize: !dev, |