-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (41 loc) · 1.12 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
const path = require("path")
const { VueLoaderPlugin } = require('vue-loader')
const Webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.s[ca]ss$/,
// 注意 当需要使用多个loader的时候,写成数组的形式,同时也需要注意使用的顺序,有的时候loader之间也是有先后关系的,比如说scss和
// scss-loader。引入顺序从逆序,也就是说从数组的最后一个慢慢执行到最前面
use: ["style-loader", "css-loader", "scss-loader"]
},
{
test: /\.m?js$/,
use: {
loader: "babel-loader",
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.(jpe?g|png|webp|gif)/,
type: "asset/resource"
}
]
},
plugins: [
new VueLoaderPlugin(),
new Webpack.DefinePlugin({ __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: true }),
]
}