framework-for-react 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +28 -6
- package/package.json +1 -1
package/babel.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const config = {
|
|
2
2
|
assumptions: {
|
|
3
3
|
privateFieldsAsProperties: true,
|
|
4
4
|
setPublicClassFields: true,
|
|
@@ -9,14 +9,36 @@ module.exports = {
|
|
|
9
9
|
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
10
10
|
['@babel/plugin-proposal-private-methods' /*, { loose: true }*/],
|
|
11
11
|
['@babel/plugin-proposal-class-properties' /*, { loose: true }*/],
|
|
12
|
-
|
|
12
|
+
],
|
|
13
|
+
compact: false,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const fs = require("fs");
|
|
18
|
+
const path = require('path');
|
|
19
|
+
|
|
20
|
+
function getPackageVersion (module) {
|
|
21
|
+
const pkgPath = path.join(__dirname + '/../' + module + '/package.json');
|
|
22
|
+
const pkgData = JSON.parse(fs.readFileSync(pkgPath));
|
|
23
|
+
return pkgData?.version;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
let antdVer = getPackageVersion('antd');
|
|
28
|
+
if (antdVer[0] < '5') {
|
|
29
|
+
console.log('antd use less than 5.x')
|
|
30
|
+
config.plugins.push([
|
|
13
31
|
'babel-plugin-import',
|
|
14
32
|
{
|
|
15
33
|
libraryName: 'antd',
|
|
16
34
|
libraryDirectory: 'lib',
|
|
17
35
|
style: 'css',
|
|
18
36
|
},
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
])
|
|
38
|
+
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.log(e)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module.exports = config
|