-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
58 lines (56 loc) · 1.58 KB
/
webpack.config.js
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
52
53
54
55
56
57
58
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
mode: 'development',
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, "dist/identify"),
watchContentBase: true,
port: 8088
},
entry:{
bundle : path.join(__dirname, "src/index.js"),
ol_Identify: path.join(__dirname, "src/js/Component/Identify/ol-Identify.js")
},
output:{
path: path.join(__dirname, "dist/identify"),
publicPath: './',
filename: '[name].js',
chunkFilename: '[chunkhash].js'
},
resolve: {
// 当你reuire时,不需要加上以下扩展名
extensions: ['.js', '.md', '.txt'],
},
module:{
rules:[
{
test: /.js$/,
use: ['babel-loader']
},
{
test: /.css$/,
use: ['style-loader', 'css-loader']
},/*解析css, 并把css添加到html的style标签里*/
{
test: /.(jpg|png|gif|svg)$/,
use: ['url-loader?limit=8192&name=./[name].[ext]']
},/*解析图片*/
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
minimize: true
}
}],
}
]
},
plugins:[
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, 'html/index.html')
})
]
}