File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
apps/shared-treeshake/host
packages/runtime-core/src/plugins Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ export default function (): ModuleFederationRuntimePlugin {
3131 apply ( instance ) {
3232 mfInstance = instance ;
3333 const isCalc = localStorage . getItem ( 'calc' ) ;
34+ if ( ! isCalc ) {
35+ return ;
36+ }
3437 // @ts -ignore
3538 __FEDERATION__ . moduleInfo = {
3639 mf_host : {
@@ -60,7 +63,7 @@ export default function (): ModuleFederationRuntimePlugin {
6063 'http://localhost:3003/independent-packages/antd/antd_mf_host.3fc92539.js' ,
6164 reShakeShareName : 'antd_mf_host' ,
6265 reShakeShareType : 'global' ,
63- treeshakeStatus : isCalc ? 2 : undefined ,
66+ treeshakeStatus : isCalc === 'no-use' ? 0 : 2 ,
6467 } ,
6568 ] ,
6669 } ,
@@ -94,7 +97,7 @@ export default function (): ModuleFederationRuntimePlugin {
9497 'http://localhost:3003/independent-packages/antd/antd_mf_host.3fc92539.js' ,
9598 reShakeShareName : 'antd_mf_host' ,
9699 reShakeShareType : 'global' ,
97- treeshakeStatus : isCalc ? 2 : undefined ,
100+ treeshakeStatus : isCalc === 'no-use' ? 0 : 2 ,
98101 } ,
99102 {
100103 assets : {
Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ export const treeShakeSharePlugin: () => ModuleFederationRuntimePlugin =
3636 if ( ! shared . fallback ) {
3737 error ( `fallback is required if enable treeshake!` ) ;
3838 }
39- shared . treeshakeStatus = TreeshakeStatus . NO_USE ;
39+ shared . treeshakeStatus =
40+ typeof treeshakeStatus !== 'undefined'
41+ ? treeshakeStatus
42+ : TreeshakeStatus . UNKNOWN ;
4043 return args ;
4144 }
4245 shared . treeshakeStatus = treeshakeStatus ;
@@ -58,6 +61,7 @@ export const treeShakeSharePlugin: () => ModuleFederationRuntimePlugin =
5861 // @ts -ignore TODO: move to webpack bundler runtime
5962 await shareEntry . init (
6063 origin ,
64+ // @ts -ignore TODO: move to webpack bundler runtime
6165 __webpack_require__ . federation . bundlerRuntime ,
6266 ) ;
6367 // @ts -ignore
You can’t perform that action at this time.
0 commit comments