Extract CSS to a file.

This commit is contained in:
2019-03-14 15:10:49 +01:00
parent 8f5692be43
commit dd05de6764
6 changed files with 14 additions and 14 deletions

View File

@@ -1,6 +1,12 @@
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
plugins: [
new MiniCssExtractPlugin({
name: "[name].css",
})
],
entry: './src/index.js',
devtool: "source-map",
output: {
@@ -12,7 +18,9 @@ module.exports = {
rules: [{
test: /\.scss$/,
use: [
"style-loader", // creates style nodes from JS strings
{
loader: MiniCssExtractPlugin.loader,
},
"css-loader?-url", // translates CSS into CommonJS
"postcss-loader", // Will run auto-prefixer for compatibility
"sass-loader" // compiles Sass to CSS, using Node Sass by default