X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/0a1546daeaea10fa8126ea50e712e5fcdda4bfd1..refs/pull/1444/head:/webpack.config.js diff --git a/webpack.config.js b/webpack.config.js index 5abde4423..4eae9b9be 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path'); const dev = process.env.NODE_ENV !== 'production'; const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const config = { target: 'web', @@ -24,46 +25,48 @@ const config = { use: { loader: 'babel-loader', options: { - presets: ['@babel/preset-env'] + presets: [[ + '@babel/preset-env', { + useBuiltIns: 'usage' + } + ]] } } }, { test: /\.scss$/, - use: [{ - loader: 'file-loader', - options: { - name: '[name].css', - context: './src/css/', - outputPath: './', - publicPath: 'public/' - } - }, { - loader: 'extract-loader', options: { - publicPath: '', - } - }, { - loader: "css-loader", options: { + use: [ + { + loader: MiniCssExtractPlugin.loader, + options: {} + }, + { + loader: "css-loader", options: { sourceMap: dev } - }, { - loader: 'postcss-loader', - options: { - ident: 'postcss', - sourceMap: dev, - plugins: (loader) => [ - require('autoprefixer')(), - ] - } - }, { - loader: "sass-loader", options: { - sourceMap: dev + }, { + loader: 'postcss-loader', + options: { + ident: 'postcss', + sourceMap: dev, + plugins: (loader) => [ + require('autoprefixer')(), + ] + } + }, { + loader: "sass-loader", options: { + sourceMap: dev + } } - }] + ] } ] }, - plugins: [] + plugins: [ + new MiniCssExtractPlugin({ + filename: "[name].css", + }), + ] }; if (dev) {