-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
56 lines (53 loc) · 1.2 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
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var webpack = require('webpack')
module.exports = {
entry: './example',
output: {
path: path.resolve('dist'),
filename: 'bundle.js'
},
resolve: {
alias: {
vue: 'vue/dist/vue.esm.js', //指定vue版本
},
extensions: ['*', '.js', '.json', '.vue'] // 引入文件时候可以省略后缀
},
devServer: {
contentBase: './dist',
host: 'localhost',
port: 8000,
open: true,
hot: true
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: '/node_modules/',
},
{
test: /\.vue$/,
use: ['vue-loader']
},
{
test: /\.css$/, //
use: [
{loader: 'vue-style-loader'},
{loader: 'css-loader'},
// {loader: 'easy-css-loader'}
{loader: path.join(__dirname, './lib/easy-css.js')}
] // 从右向左解析
}
]
},
plugins: [
new VueLoaderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: './index.html'
}),
]
}