-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
85 lines (80 loc) · 1.85 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// const config = require('./test-hot/webpack.config')
// module.exports = config
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const config = {
mode: 'production',
entry: {
// test: './test/index.js',
// testVue: './test-vue/main.js',
testAssets: './test-assets/index.js'
},
output: {
filename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/i,
// type: 'asset/inline',
// type: 'asset/resource'
use: [
{
loader: 'file-loader',
},
],
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
exclude: /node_modules/,
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
exclude: /node_modules/
},
]
},
optimization: {
// runtimeChunk: {
// name: 'runtime',
// },
},
plugins: [
new VueLoaderPlugin(),
new MiniCssExtractPlugin(),
new webpack.DefinePlugin({
TWO: '1+1',
TWO1: 1+1,
'typeof window': JSON.stringify('object'),
})
// new webpack.HotModuleReplacementPlugin(),
// new HtmlWebpackPlugin({
// template: './test-vue/index.html',
// filename: 'index.html' // 生成的文件名
// }),
],
// devServer: {
// hot: true,
// contentBase: path.join(__dirname, 'dist'),
// port: 8888,
// https: false,
// open: false
// },
}
module.exports = config