Commit 3c571f0f authored by 杨思琦's avatar 杨思琦

perf: 调整公共包加载

parent e7fcbd4f
......@@ -287,24 +287,6 @@ export const loadMicroApps = (apps, pathName) => {
}
}
const loadPlugins = () => {
require.ensure([], () => {
const commonPackage = {
'mqtt-client': { require: require.context('../node_modules/mqtt-client/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), entry: 'index.js' },
'js-base64': { require: require.context('../node_modules/js-base64', true, /[^\/]+\.js$/), entry: 'base64.js' },
'qr.js': { require: require.context('qr.js', true, /^.\/index\.js$/), entry: 'index.js' },
'query-string': { require: require.context('query-string', true, /^.\/index\.js$/), entry: 'index.js' },
'kit_logger': { require: require.context('../node_modules/kit_logger/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), entry: 'index.js' },
'kit_utils': { require: require.context('../node_modules/kit_utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), entry: 'index.js' },
'kit_global_config': { require: require.context('../node_modules/kit_global_config/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), entry: 'index.js' },
'echarts': { require: require.context('../node_modules/echarts/dist', true, /^.\/echarts.min\.js$/), entry: 'echarts.min.js' },
};
Object.keys(commonPackage).map((pkg) => {
window.app.define(pkg, commonPackage[pkg].require, commonPackage[pkg].entry);
})
})
}
const loadMicroPackage = (name) => {
require.ensure([], () => {
microPackage[name].map((item) => {
......@@ -333,7 +315,6 @@ export const initMicroApps = (url) => {
}
return !/civweb4/.test(app.name) && url.indexOf(app.name) < 0 && !app.noPrefetch
}) ?? [];
loadPlugins();
if(window?.qiankunIsCache){
microStore.on("event:dropCache", (() => {
micorManager.map((micro) => {
......@@ -488,19 +469,34 @@ window.app.define('react', require.context('react', true, /^.\/index\.js$/), 'in
window.app.define('react/jsx-runtime', require.context('../node_modules/react', true, /^.\/jsx-runtime\.js$/), 'jsx-runtime.js');
window.app.define('react-dom', require.context('react-dom', true, /^.\/index\.js$/), 'index.js');
window.app.define('react-router', require.context('react-router', true, /^.\/index\.js$/), 'index.js');
window.app.define('lodash', require.context('lodash', true, /^.\/index\.js$/), 'index.js');
window.app.define('connected-react-router', require.context('../node_modules/connected-react-router/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('react-helmet', require.context('../node_modules/react-helmet/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'Helmet.js');
window.app.define('qrcode.react', require.context('../node_modules/qrcode.react/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('qr.js', require.context('qr.js', true, /^.\/index\.js$/), 'index.js');
window.app.define('query-string', require.context('query-string', true, /^.\/index\.js$/), 'index.js');
window.app.define('react-helmet-async', require.context('../node_modules/react-helmet-async/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('immutable', require.context('../node_modules/immutable/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'immutable.min.js');
window.app.define('redux-immutable', require.context('../node_modules/redux-immutable/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'index.js');
window.app.define('redux-logger', require.context('../node_modules/redux-logger/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'redux-logger.js');
window.app.define('react-router-dom', require.context('react-router-dom', true, /^.\/index\.js$/), 'index.js');
window.app.define('react-redux', require.context('../node_modules/react-redux/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'react-redux.min.js');
window.app.define('redux', require.context('../node_modules/redux/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'redux.min.js')
window.app.define('redux', require.context('../node_modules/redux/dist', true, /^.\/(dist\/)?[^\/]+\.js$/), 'redux.min.js');
window.app.define('mqtt-client', require.context('../node_modules/mqtt-client/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('kit_logger', require.context('../node_modules/kit_logger/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('kit_utils', require.context('../node_modules/kit_utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/));
window.app.define('kit_global_config', require.context('../node_modules/kit_global_config/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('axios', require.context('../node_modules/axios/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'axios.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('js-base64', require.context('../node_modules/js-base64', true, /[^\/]+\.js$/), 'base64.js');
window.app.define('@wisdom-utils/utils', require.context('../node_modules/@wisdom-utils/utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-utils/runtime', require.context('../node_modules/@wisdom-utils/runtime/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/amap', require.context('../node_modules/@wisdom-map/amap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wisdom-map/arcgismap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/basemap', require.context('../node_modules/@wisdom-map/basemap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@ant-design/pro-list', require.context('../node_modules/@ant-design/pro-list/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@ant-design/pro-utils', require.context('../node_modules/@ant-design/pro-utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@ant-design/pro-layout', require.context('../node_modules/@ant-design/pro-layout/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
......@@ -509,12 +505,5 @@ window.app.define('@ant-design/pro-form', require.context('../node_modules/@ant-
window.app.define('@ant-design/pro-provider', require.context('../node_modules/@ant-design/pro-provider/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('pinyin-match', require.context('../node_modules/pinyin-match/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'main.js');
window.app.define('react-intl', require.context('../node_modules/react-intl/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('echarts', require.context('../node_modules/echarts/dist', true, /^.\/echarts.min\.js$/), 'echarts.min.js');
window.app.define('moment', require.context('moment', true, /^.\/moment\.js$/), 'moment.js');
\ No newline at end of file
window.app.define('lodash', require.context('lodash', true, /^.\/index\.js$/), 'index.js');
window.app.define('@wisdom-utils/utils', require.context('../node_modules/@wisdom-utils/utils/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-utils/runtime', require.context('../node_modules/@wisdom-utils/runtime/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-utils/components', require.context('../node_modules/@wisdom-utils/components/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wisdom-map/arcgismap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/amap', require.context('../node_modules/@wisdom-map/amap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('@wisdom-map/basemap', require.context('../node_modules/@wisdom-map/basemap/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
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