-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
34 lines (32 loc) · 905 Bytes
/
webpack.config.js
File metadata and controls
34 lines (32 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// Create multiple instances
const extractCSS = new ExtractTextPlugin('public/css/[name].css');
const extractLESS = new ExtractTextPlugin('public/css/common.less');
module.exports = {
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.css$/,
use: extractCSS.extract(['css-loader', 'style-loader'])
}, {
test: /\.less$/i,
use: extractLESS.extract(['css-loader', 'less-loader'])
}
]
},
plugins: [
extractCSS, extractLESS
],
devServer: {
contentBase: "./public", //本地服务器所加载的页面所在的目录
colors: true, //终端中输出结果为彩色
historyApiFallback: true, //不跳转
inline: true //实时刷新
}
};