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
| 'use strict'
| const { join } = require('path')
| const HtmlWebpackPlugin = require('html-webpack-plugin')
| const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
| const config = {
| mode: 'development',
| entry: './src/main.js',
| resolve: {
| // 配置别名,在项目中可缩减引用路径
| alias: {
| src: join(__dirname, '/src')
| }
| },
| module: {
| rules: [
| {
| test: /\.vue$/,
| use: 'vue-loader'
| },
| {
| test: /\.js$/,
| use: 'babel-loader',
| exclude: /node_modules/
| },
| {
| test: /\.css$/,
| use: ['style-loader', 'css-loader']
| },
| {
| test: /\.html$/i,
| loader: 'html-loader'
| },
| {
| test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
| exclude: /favicon\.png$/,
| use: [
| {
| loader: 'url-loader',
| options: {
| limit: 10000
| }
| }
| ]
| }
| ]
| },
| plugins: [
| new VueLoaderPlugin(),
| new HtmlWebpackPlugin({
| template: './src/index.html',
| inject: 'body'
| })
| ],
| devServer: {
| host: '127.0.0.1',
| port: 8020,
| historyApiFallback: false,
| noInfo: true,
| open: true
| },
| devtool: '#eval-source-map'
| }
|
| module.exports = config
|
|