From 52ffcdacc96b369b3f7f494e9109d091007c1f8b Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Tue, 7 Jul 2020 16:00:49 +0800 Subject: [PATCH] chore: update webpack config --- webpack.config.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 4c9d17017..9a6576cc2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,8 +1,8 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/dist/plugin').default; -const webpack = require('webpack'); const WebpackBar = require('webpackbar'); const path = require('path'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = { mode: 'development', @@ -84,7 +84,15 @@ module.exports = { }, { test: /\.css$/, - use: ['css-loader'], + use: [ + { + loader: MiniCssExtractPlugin.loader, + options: { + hmr: true, + }, + }, + 'css-loader', + ], }, ], }, @@ -103,9 +111,11 @@ module.exports = { hot: true, open: true, }, - devtool: '#source-map', + devtool: 'cheap-module-eval-source-map', plugins: [ - new webpack.HotModuleReplacementPlugin(), + new MiniCssExtractPlugin({ + filename: '[name].css', + }), new HtmlWebpackPlugin({ template: 'examples/index.html', filename: 'index.html',