X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/2ede273ef32f70a9434f9be5850e7d298167669d..refs/pull/2022/head:/webpack.config.js diff --git a/webpack.config.js b/webpack.config.js index c5ce4829f..e496340c4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,17 +1,16 @@ const path = require('path'); const dev = process.env.NODE_ENV !== 'production'; -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const config = { target: 'web', mode: dev? 'development' : 'production', entry: { - app: './resources/assets/js/index.js', - styles: './resources/assets/sass/styles.scss', - "export-styles": './resources/assets/sass/export-styles.scss', - "print-styles": './resources/assets/sass/print-styles.scss', + app: './resources/js/index.js', + styles: './resources/sass/styles.scss', + "export-styles": './resources/sass/export-styles.scss', + "print-styles": './resources/sass/print-styles.scss', }, output: { filename: '[name].js', @@ -19,44 +18,30 @@ const config = { }, module: { rules: [ - { - test: /\.js$/, - exclude: /(node_modules)/, - use: { - loader: 'babel-loader', - options: { - presets: ['@babel/preset-env'] - } - } - }, { test: /\.scss$/, - use: ExtractTextPlugin.extract({ - fallback: "style-loader", - use: [{ + use: [ + { + loader: MiniCssExtractPlugin.loader, + options: {} + }, + { loader: "css-loader", options: { - sourceMap: dev - } - }, { - loader: 'postcss-loader', - options: { - ident: 'postcss', - sourceMap: dev, - plugins: (loader) => [ - require('autoprefixer')(), - ] - } + sourceMap: dev + } }, { loader: "sass-loader", options: { sourceMap: dev } - }] - }) + } + ] } ] }, plugins: [ - new ExtractTextPlugin("[name].css"), + new MiniCssExtractPlugin({ + filename: "[name].css", + }), ] }; @@ -64,8 +49,4 @@ if (dev) { config['devtool'] = 'inline-source-map'; } -if (!dev) { - config.plugins.push(new UglifyJsPlugin()); -} - module.exports = config; \ No newline at end of file