-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (41 loc) · 997 Bytes
/
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); //通过 npm 安装
const webpack = require('webpack'); //to access built-in plugins
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
app: path.resolve(__dirname, './src/app')
},
plugins: [
new HtmlWebpackPlugin({
title: 'es6',
template: path.resolve(__dirname, './src/index.html')
}),
// new CleanWebpackPlugin(['dist'])
],
output: {
path: path.resolve(__dirname, './dist'),
// filename: '[name].bundle.[hash:8].js'
filename: '[name].bundle.js'
},
module: {
loaders: [
{
test: /\.js[x]?$/,
exclude: /(node_modules)/,
use: [{
loader: 'babel-loader',
query:
{
presets: ['es2015']
}
}]
}
]
},
devServer: {
contentBase: path.resolve(__dirname, './dist'),
port:9999,
host:'127.0.0.1'
},
};