-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·51 lines (50 loc) · 1.43 KB
/
Copy pathwebpack.config.js
File metadata and controls
executable file
·51 lines (50 loc) · 1.43 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* 一个webpack配置的模板,当前为dev环境
* @type {webpack}
*/
let webpack = require('webpack'),
path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
mode: 'development',
entry: {
index: path.join(__dirname, './src/indexPage/index.js'), // 工程入口
flightList: path.join(__dirname, './src/flightList/flightList.js'), // flightList工程入口
lib: path.join(__dirname, './src/lib.js') // 单独打包库
},
output: {
path: path.join(__dirname, 'build'),
filename: '[name].bundle.js',
publicPath: '/build/'
},
module: {
rules:[
{
test: /\.js[x]?$/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader?presets[]=react,presets[]=es2015,presets[]=stage-0'
}]
},
{
test: /\.[s]?css$/,
use: [{
loader: 'style-loader'
},{
loader: 'css-loader'
},{
loader: 'sass-loader'
}]
}
]
},
devServer: {
contentBase: "./",
historyApiFallback: true,
hot:true
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // 模块热更新
new ExtractTextPlugin("styles.css")
]
};