-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbp.config.js
113 lines (112 loc) · 2.55 KB
/
mbp.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* Created by ximing on 2019-03-14.
*/
const path = require("path");
const MPB = require("mpbuild");
module.exports = (
entry,
{ needUglify } = { needUglify: true }
) => {
return {
// 入口配置文件
entry,
// 源码对应目录
src: path.join(__dirname, "src"),
alias: {},
output: {
path: path.join(__dirname, "dist"),
npm: "npm"
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".tsx", ".ts", ".js", ".json", ".wxml", ".wxss"]
},
optimization: {
minimize: {
js: needUglify,
wxml: true,
json: true
}
},
exts: [".ts", ".js", ".json", ".wxml", ".wxss"],
resources: "./res",
module: {
rules: [
{
test: /\.wxss$/,
use: [
{
loader: "postcss-loader",
options: {
parser: require("postcss-scss"),
plugins: [
require("postcss-advanced-variables")({
variables: {},
disable: "@mixin, @include,@content, @import"
}),
require("postcss-nested")({ bubble: ["keyframes"] }),
require("cssnano")({
preset: ["default", { calc: false }]
})
]
}
}
]
},
{
test: /\.js$/,
include: [
"**/node_modules/@mtfe/**/*",
"**/node_modules/@tarojs/**/*"
],
exclude: ["**/node_modules/**"],
use: [
{
loader: "babel-loader"
}
]
},
{
test: /\.(ts|tsx)$/,
include: [
"**/node_modules/@mtfe/**/*",
"**/node_modules/@tarojs/**/*"
],
exclude: ["**/node_modules/**/*"],
use: [
{
loader: "babel-loader"
},
{
loader: "ts-loader"
}
]
},
{
test: /\.json$/,
use: [
{
loader: "json-loader"
}
]
},
{
test: /\.wxml$/,
use: []
}
]
},
plugins: [
new MPB.CleanMbpPlugin({
path: ["dist/**/*", "!dist/project.config.json"]
}),
new MPB.TsTypeCheckPlugin({
project: __dirname
}),
new MPB.ProjectConfigPlugin({
projectname: "mp-ide",
appId: "wx46db488db3c5481f"
})
]
};
};