framework-for-react 1.0.4 → 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/index.js +3 -2
- 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
|
package/index.js
CHANGED
|
@@ -16,11 +16,11 @@ const APP_DIST = path.join(APP_PATH, '/dist');
|
|
|
16
16
|
const dir_path = path.resolve(__dirname);
|
|
17
17
|
|
|
18
18
|
const devMode = process.env.NODE_ENV !== 'production';
|
|
19
|
-
|
|
19
|
+
const entryPoint = 'default_entry';
|
|
20
20
|
const webpackConfig = {
|
|
21
21
|
devtool: devMode,
|
|
22
22
|
entry: {
|
|
23
|
-
|
|
23
|
+
[entryPoint]: [path.join(APP_SRC, '/main.js')],
|
|
24
24
|
vendors: [
|
|
25
25
|
'@babel/polyfill',
|
|
26
26
|
'react',
|
|
@@ -116,6 +116,7 @@ const webpackConfig = {
|
|
|
116
116
|
removeComments: true,
|
|
117
117
|
collapseWhitespace: true
|
|
118
118
|
},
|
|
119
|
+
chunks: [entryPoint],
|
|
119
120
|
favicon: path.join(APP_SRC, '/asset/images/ico.ico'),
|
|
120
121
|
template: path.join(APP_SRC, '/template/index.html')
|
|
121
122
|
})
|