-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
70 lines (67 loc) · 1.91 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
59
60
61
62
63
64
65
66
67
68
69
70
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'development',
target: 'web',
entry: path.join(__dirname, 'src/index.js'),
devtool: 'inline-source-map',
output: {
filename: '[name].bundle.js',
path: path.join(__dirname, 'dist')
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 8081,
compress: true,
overlay: {
errors: true,
},
open: true,
},
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
}, {
// 它会应用到普通的 `.jsx` 文件
// 以及 `.vue` 文件中的 `<script>` 块
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
}, {
test: /\.styl/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
sourceMap: true
}
},
'stylus-loader'
]
}, {
// 它会应用到普通的 `.css` 文件
// 以及 `.vue` 文件中的 `<style>` 块
test: /\.css$/,
use: [
'vue-style-loader',
'style-loader',
'css-loader'
]
}, {
test: /\.(woff|svg|eot|ttf)\??.*$/,
loader: 'url-loader?name=iconfont/[name].[md5:hash:hex:7].[ext]'
}]
},
plugins: [
new VueLoaderPlugin(),
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new HtmlWebpackPlugin({
title: 'Development',
})
],
}