aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-03-07 11:58:50 +0300
committerGravatar Vitaly Takmazov2023-03-07 11:58:50 +0300
commit8af8f854e5fc1c6a960baf80fa1b439780a4a2e8 (patch)
tree729250c3063bbefe4215c3062e2bddd38ccf9e4e /webpack.config.js
parentca9b2565e5e880fdc551341df92f15f33434a7c8 (diff)
Compile legacy with webpack
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js39
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,