-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
executable file
·78 lines (74 loc) · 1.89 KB
/
config-overrides.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
/**
* Class:
* Author: wufei
* Date: 2019/5/25
* Description:
* webpack 按需加载
*/
const {
override,
fixBabelImports,
addWebpackAlias,
addLessLoader,
disableChunk
} = require("customize-cra");
const theme = require("./package.json").theme;
const path = require("path");
const addCustomize = () => config => {
require("react-app-rewire-postcss")(config, {
plugins: loader => [
require("postcss-flexbugs-fixes"),
require("postcss-preset-env")({
autoprefixer: {
flexbox: "no-2009"
},
stage: 3
}),
require("postcss-aspect-ratio-mini")({}),
require("postcss-px-to-viewport")({
viewportWidth: 375,
viewportHeight: 667,
unitPrecision: 2,
viewportUnit: "vw",
selectorBlackList: [".ignore", ".hairlines"],
minPixelValue: 1,
mediaQuery: false
}),
require("postcss-write-svg")({
utf8: false
}),
require("postcss-viewport-units")({}),
require("cssnano")(
require("cssnano-preset-advanced")({
zindex: false,
autoprefixer: false
})
)
]
});
return config;
};
// 关闭 sourcemap
process.env.GENERATE_SOURCEMAP = "false";
module.exports = override(
addWebpackAlias({
"@assets": path.resolve(__dirname, "src/assets"),
"@baseUI": path.resolve(__dirname, "src/baseUI"),
"@components": path.resolve(__dirname, "src/components"),
"@containers": path.resolve(__dirname, "src/containers"),
"@reduxs": path.resolve(__dirname, "src/reduxs"),
"@routes": path.resolve(__dirname, "src/routes"),
"@utils": path.resolve(__dirname, "src/utils"),
"@api": path.resolve(__dirname, "src/api")
}),
fixBabelImports("import", {
libraryName: "antd-mobile",
style: true
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: theme
}),
addCustomize(),
disableChunk()
);