1 | const isProduction = process.env.NODE_ENV === "production";
|
2 | const plugins = [
|
3 | ["import", {
|
4 | libraryName: "ant-design-vue",
|
5 | libraryDirectory: "es",
|
6 | style: "css",
|
7 | }],
|
8 | [
|
9 | "component",
|
10 | {
|
11 | "libraryName": "element-ui",
|
12 | "styleLibraryName": "theme-chalk",
|
13 | },
|
14 | ],
|
15 | "@babel/plugin-syntax-dynamic-import",
|
16 | ];
|
17 |
|
18 | if (isProduction) plugins.push("babel-plugin-transform-remove-console");
|
19 |
|
20 | module.exports = {
|
21 | presets: [
|
22 | "@vue/babel-preset-jsx",
|
23 | ["@babel/preset-env", {
|
24 | "loose": true,
|
25 | "modules": false,
|
26 | "useBuiltIns": isProduction ? false : "usage",
|
27 | "spec": true,
|
28 | "corejs": 3,
|
29 | "targets": {
|
30 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"],
|
31 | },
|
32 | }],
|
33 | ],
|
34 | env: {
|
35 | test: {
|
36 | presets: [
|
37 | "@vue/babel-preset-jsx",
|
38 | ["@babel/preset-env", { "targets": { "node": "current" } }]
|
39 | ],
|
40 | },
|
41 | },
|
42 | plugins,
|
43 | };
|