Commit e4f961dc authored by 邓晓峰's avatar 邓晓峰

fix: 修复flat方法兼容性处理

parent d716e650
Pipeline #39085 passed with stages
in 23 minutes 37 seconds
......@@ -23,7 +23,8 @@ module.exports = opts => {
'@babel/preset-env',
{
...mergeConfig(defaultEnvConfig,{}),
modules: false
modules: false,
...opts.env
},
],
// opts.react && ['@babel/preset-react'],
......@@ -56,17 +57,17 @@ module.exports = opts => {
'@babel/plugin-proposal-logical-assignment-operators',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
// opts.transformRuntime && [
// '@babel/plugin-transform-runtime',
// {
// version: require('@babel/runtime/package.json').version,
// absoluteRuntime: dirname(
// require.resolve('@babel/runtime/package.json'),
// ),
// useESModules: true,
// ...toObject(opts.transformRuntime),
// },
// ],
opts.transformRuntime && [
'@babel/plugin-transform-runtime',
{
version: require('@babel/runtime/package.json').version,
absoluteRuntime: dirname(
require.resolve('@babel/runtime/package.json'),
),
useESModules: true,
...toObject(opts.transformRuntime),
},
],
[
'babel-plugin-transform-react-remove-prop-types',
{
......
......@@ -127,6 +127,9 @@ export function simpleNormalizeChildren(children) {
export const generFlatRoutes = (widgets, parent, subSystem, modulePkg) => {
const treeKeys = [];
const flatMenu = [];
if(!widgets || Array.isArray(widgets) && widgets.length === 0) {
return [];
}
(widgets || []).forEach(item => {
if (item.hasOwnProperty('routes')) {
const route = generFlatRoutes(item.routes, item, item.name, modulePkg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment