-
-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Unify Federation with ModernJS & Byte Infra team #1268
Merged
Merged
Changes from 8 commits
Commits
Show all changes
272 commits
Select commit
Hold shift + click to select a range
10fb1ae
Merge remote-tracking branch 'origin/improve_auto_public_path' into i…
ScriptedAlchemy c374178
chore: fix webpack build config of host
ScriptedAlchemy b654643
refactor: Improved readability and documentation of httpVmStrategy fu…
ScriptedAlchemy e5535b5
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 9611138
Merge pull request #1312 from module-federation/improve_auto_public_path
ScriptedAlchemy bdf6d03
refactor: refactor DelegateModulesPlugin.ts
ScriptedAlchemy 7d192b3
Merge branch 'main' into node_auto_public_path
ScriptedAlchemy 90fff24
chore(node): add jest environment and webpack global to ESLint config…
ScriptedAlchemy df8bb79
feat(utilities): update DelegateModulesPlugin and tests (#node_auto_p…
ScriptedAlchemy a83f67c
chore(node): remove unused importMetaName and update parseRemotes tes…
ScriptedAlchemy ee9e918
chore update locks
ScriptedAlchemy 5064f18
chore(node-remote): enable disk writes in development mode #node_auto…
ScriptedAlchemy 760703f
Merge branch 'main' into node_auto_public_path
ScriptedAlchemy b12c984
feat: add auto public path support for remote modules (node_auto_publ…
ScriptedAlchemy 65989da
feat(node): auto set public path and improve chunk loading strategy #…
ScriptedAlchemy 454dbd4
Merge branch 'node-sync-bytedance' into node_auto_public_path
ScriptedAlchemy 3a105e7
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy d4e2be8
style(node): disable eslint for getDependenciesOfChunk function in Ch…
ScriptedAlchemy b60967b
refactor(node): destructure chunkHasJs from jsModulePlugin for cleane…
ScriptedAlchemy f9787a9
feat(node): remove unused import from DynamicFilesystemRuntimeModule
ScriptedAlchemy d420ad9
fix(node): use ES6 imports and override method in FederationModuleInf…
ScriptedAlchemy 0c06ce9
remove usage of createDelegatedModule from nextjs-mf (#node-sync-byt…
ScriptedAlchemy 12559f4
lock file
ScriptedAlchemy 0cd1626
Merge branch 'node-sync-bytedance' into node_auto_public_path
ScriptedAlchemy 967782d
lock file
ScriptedAlchemy 0a5df1e
chore(deps): update dependency @types/express to v4.17.17
ScriptedAlchemy 1f3f197
chore(deps): update dependency @vitest/coverage-c8 to v0.33.0
ScriptedAlchemy fa5184b
Merge pull request #1326 from module-federation/renovate/express-4.x
ScriptedAlchemy 25a4f9a
chore(deps): update dependency @vitest/ui to v0.34.3
ScriptedAlchemy b35731d
Merge pull request #1327 from module-federation/renovate/vitest-cover…
ScriptedAlchemy 993be1c
Merge pull request #1330 from module-federation/renovate/vitest-ui-0.x
ScriptedAlchemy 87d73cc
fix(deps): pin dependency lodash.get to 4.4.2
ScriptedAlchemy b3a9d1b
chore(deps): update dependency @vitest/coverage-istanbul to v0.34.3
ScriptedAlchemy cab7523
chore(deps): update dependency esbuild to v0.19.2
ScriptedAlchemy df3e814
Merge pull request #1331 from module-federation/renovate/esbuild-0.x
ScriptedAlchemy f1265e5
Merge pull request #1329 from module-federation/renovate/lodash-monorepo
ScriptedAlchemy 71cd67c
Merge pull request #1328 from module-federation/renovate/vitest-cover…
ScriptedAlchemy 4e4431b
lock file
ScriptedAlchemy 905bf82
fix(deps): pin dependencies
ScriptedAlchemy eacb130
Merge pull request #1325 from module-federation/renovate/pin-dependen…
ScriptedAlchemy 05f9284
Simplified the logic for adding AutoPublicPathRuntimeModule to the co…
ScriptedAlchemy 7df7bb2
lock file
ScriptedAlchemy 6b3355c
Merge pull request #1342 from module-federation/improve_auto_public_p…
ScriptedAlchemy e7563b7
chore(deps): update dependency @vitest/ui to v0.34.4
ScriptedAlchemy a5c3dcb
Merge pull request #1350 from module-federation/renovate/vitest-ui-0.x
ScriptedAlchemy 275a781
chore(deps): update dependency @vitest/coverage-istanbul to v0.34.4
ScriptedAlchemy 4441f6e
Merge pull request #1349 from module-federation/renovate/vitest-cover…
ScriptedAlchemy f5b620c
Update default-delegate.ts
ScriptedAlchemy 1bcd266
Merge pull request #1307 from module-federation/node_auto_public_path
ScriptedAlchemy 5bea5b4
chore(node): enhance code readability in FederationModuleInfoRuntimeM…
ScriptedAlchemy ca33d98
feat(NodeFederationPlugin): assign remoteContainerRegistry to importM…
ScriptedAlchemy 061285e
feat(node): enhance error handling and remote container registry in R…
ScriptedAlchemy 5ac0e4b
lock files
ScriptedAlchemy 5eb2092
feat(node-remote): Improve module federation runtime compatibility
ScriptedAlchemy 63331ae
chore: Demo local remote
ScriptedAlchemy d311170
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy e84066c
update lock
ScriptedAlchemy 5348111
Merge branch 'node-sync-bytedance' into local_remotes
ScriptedAlchemy 93bf799
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 63b2a51
Merge branch 'node-sync-bytedance' into local_remotes
ScriptedAlchemy 74197fa
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy b373a77
Merge branch 'node-sync-bytedance' into local_remotes
ScriptedAlchemy 8c4acdc
chore: updae locks
ScriptedAlchemy 459ff60
Merge remote-tracking branch 'origin/local_remotes' into local_remotes
ScriptedAlchemy 2429fc8
chore: lock files
ScriptedAlchemy 313640a
Merge branch 'main' into local_remotes
ScriptedAlchemy 221f61e
chore: node local remote example
ScriptedAlchemy 366e6df
chore: node local remote example
ScriptedAlchemy 5c30128
chore: node local remote example
ScriptedAlchemy 5c6107c
chore: node local remote example
ScriptedAlchemy 8872327
Merge branch 'local_remote_app' into local_remotes
ScriptedAlchemy ca5fa50
chore: increase parallelism of nx
ScriptedAlchemy 4d1528b
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy b5114c7
Merge branch 'node-sync-bytedance' into local_remotes
ScriptedAlchemy 8f5de2f
Merge pull request #1375 from module-federation/local_remotes
ScriptedAlchemy fbe19bc
feat: remove old loadScript hack
ScriptedAlchemy bc8a541
chore: fix examples
ScriptedAlchemy 0e2aee0
Merge branch 'main' into local_remotes
ScriptedAlchemy d0f5a52
Merge branch 'node-sync-bytedance' into local_remotes
ScriptedAlchemy 564ed1f
chore: fix examples
ScriptedAlchemy 07a439c
Merge pull request #1384 from module-federation/local_remotes
ScriptedAlchemy df7f423
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 5704c8d
refactor: break public path into own function
ScriptedAlchemy 9f7e0fe
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 713ed91
chore(utils): release version 3.0.2-beta.0
ScriptedAlchemy 2767191
fix: import utils manually
ScriptedAlchemy 33b5ce7
chore(utils): release version 3.0.2
ScriptedAlchemy 6e1003d
chore(node): release version 2.0.2-beta.0
ScriptedAlchemy d53b586
feat: support vmok conventions
ScriptedAlchemy 0501da8
feat: support vmok conventions
ScriptedAlchemy 1bd9dba
chore(node): release version 2.0.2-beta.1
ScriptedAlchemy a08fcab
fix: ensure custom FS works with target: node or async node preset
ScriptedAlchemy 65f17b1
fix: Auto Public Path, detect multiple output targets
ScriptedAlchemy 98cd8fd
Merge branch 'node-sync-bytedance' into vmok/public-path
ScriptedAlchemy b4e633b
fix: simplify template
ScriptedAlchemy c956e52
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 1e9bfb9
chore(node): release version 2.0.2-beta.2
ScriptedAlchemy ef74cbc
Merge pull request #1387 from module-federation/vmok/public-path
ScriptedAlchemy c11dc96
Merge remote-tracking branch 'origin/node-sync-bytedance' into node-s…
ScriptedAlchemy f22dc25
fix: search registry for both ident and unique name
ScriptedAlchemy 37a236e
sync with byte
ScriptedAlchemy d0b6852
rename files, remove olds
ScriptedAlchemy 3c58780
feat: Static fallback to non auto public path
ScriptedAlchemy 9d0fcdd
feat: create and expose AutomaticPublicPathPlugin.ts
ScriptedAlchemy aafa76e
refactor: server apply
ScriptedAlchemy 1549a37
refactor: reload local share scope into global memory
ScriptedAlchemy aec9506
refactor: reload local share scope into global memory
ScriptedAlchemy e89f2fe
WIP next/node stuff
ScriptedAlchemy 0a2c1af
eject webpack
ScriptedAlchemy 019694e
feat: improved async init
ScriptedAlchemy 08aa0fa
feat: improved async init
ScriptedAlchemy 845798c
Merge branch 'main' into next_byte_implementation
ScriptedAlchemy 40e3576
add todo
ScriptedAlchemy 9048da4
Merge branch 'main' into next_byte_implementation
ScriptedAlchemy 6f4040e
Merge branch 'main' into next_byte_implementation
ScriptedAlchemy 9b8f652
fix: ts in template string
ScriptedAlchemy de74b75
Merge branch 'main' into next_byte_implementation
ScriptedAlchemy 0edbbea
fix: ts in template string
ScriptedAlchemy 37e790a
fix: ts in template string
ScriptedAlchemy 579b341
fix: ts in template string
ScriptedAlchemy 0a0d03d
fix: ts in template string
ScriptedAlchemy d506b49
fix: TS imports to webpack
ScriptedAlchemy e021d66
feat: Use enhanced Federation Plugin
ScriptedAlchemy b0f7b56
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 126032e
style: prettier lint
ScriptedAlchemy ed5d992
Merge branch 'node-sync-bytedance' into next_byte_implementation
ScriptedAlchemy 974deb3
style: prettier lint
ScriptedAlchemy cc2e53f
fix: bad impleentation during federation port
ScriptedAlchemy c370101
chore: types
ScriptedAlchemy 49b8e3a
re-enable remote imports
ScriptedAlchemy 73352fa
restore normal operations
ScriptedAlchemy 992d298
fix: package data
ScriptedAlchemy 9ed3441
build: build dependencies
ScriptedAlchemy 92130e2
export contaainr plugins
ScriptedAlchemy b2fc5a2
chore: temp container inversion plugin
ScriptedAlchemy 22098c6
chore: update Ts module type to Node16
ScriptedAlchemy 718c3fc
feat: remove custom jsonp runtime patching
ScriptedAlchemy 52ad258
feat: container inversion module injection
ScriptedAlchemy 2dc23fc
build: update scripts and tsconfig
ScriptedAlchemy 39e37b6
style: prettier
ScriptedAlchemy 0604461
feat: additional plugin exports
ScriptedAlchemy f40c538
fix: change exports for module info runtime
ScriptedAlchemy 17640dc
feat(enhanced): async boundary plugin
ScriptedAlchemy 66ac81d
feat(enhanced): Embedded Container Plugin
ScriptedAlchemy 4d80a2c
refactor(ContainerInversion): apply embed and async boundary plugins
ScriptedAlchemy 427e237
refactor: remote attach runtime module.
ScriptedAlchemy 0633e3d
remove early return bailout from eager shared module plugin
ScriptedAlchemy f6e3720
refactor: apply plugin partials
ScriptedAlchemy b8c9859
feat: rewrite next federation vanity plugin
ScriptedAlchemy bce3a31
refactor: remove comments and old ts stuff
ScriptedAlchemy 858d103
refactor: remove duplicate plugins and use enhanced
ScriptedAlchemy 2f83d23
silence logs on package patch
ScriptedAlchemy 49b4a57
fix(enhanced): module info duplication
ScriptedAlchemy e7ac801
fix: add missing serialize method on RemoteModule
ScriptedAlchemy 9bab3de
fix: reduce noise on async boundary plugin
ScriptedAlchemy 90caa8d
fix: module order of inverted container runtime
ScriptedAlchemy c370ed5
fix: remove logger in filesystem
ScriptedAlchemy 0aeec43
chore: cleanup code
ScriptedAlchemy 415eda1
demo code
ScriptedAlchemy c748caa
fixes
ScriptedAlchemy 7b12c96
comment out bugs
ScriptedAlchemy 8eb422d
fix: TS imports, missing module methods
ScriptedAlchemy b5ceb3f
Merge branch 'node-sync-bytedance' into next_byte_implementation
ScriptedAlchemy d498d01
chore: add MFP types
ScriptedAlchemy 99bd90b
chore: add MFP types
ScriptedAlchemy ed89420
chore: eslint stuff
ScriptedAlchemy f6e3e7f
fix: ignore TS issues in async plugin
ScriptedAlchemy 0296443
refactor: apply module info plugin manually
ScriptedAlchemy 3afe08a
refactor: remove hooks from delegate module plugin
ScriptedAlchemy 713bcb4
style: lint
ScriptedAlchemy eb5a0c6
style: lint
ScriptedAlchemy 0079495
style: lint
ScriptedAlchemy 649bfc3
style: lint
ScriptedAlchemy 1ec5f0f
feat: use enhanced federation plugin
ScriptedAlchemy 12ed54c
fix: export parseRemotes
ScriptedAlchemy ea4f105
fix: lint container module
ScriptedAlchemy 5e584e6
feat: implement custom next vanity federation plugin
ScriptedAlchemy b69b70d
feat: improve options logic in node federation plugin
ScriptedAlchemy 19b1afb
fix: add exported file
ScriptedAlchemy 023dfaf
style: ts imports
ScriptedAlchemy 075015a
style: ts imports
ScriptedAlchemy 197d26f
style: ts imports
ScriptedAlchemy 7764d1f
style: ts imports
ScriptedAlchemy 1d0fdec
style: ts imports
ScriptedAlchemy 9ecce7e
chore: update webpack TS sync logic
ScriptedAlchemy 5493346
update postinstall
ScriptedAlchemy d605dc5
style: prettier
ScriptedAlchemy 844c12f
prettier webpack types
ScriptedAlchemy 1f020fe
Merge branch 'node-sync-bytedance' into next_byte_implementation
ScriptedAlchemy 9c190d9
chore: update TS files
ScriptedAlchemy 875038a
fix: add override to remoteModule
ScriptedAlchemy 7b52c43
remaining stuff
ScriptedAlchemy 5ae3548
linst issues
ScriptedAlchemy 4db1f3d
remove tests
ScriptedAlchemy 980fc7f
ignore typesciprt crap
ScriptedAlchemy c13ea37
enable nested imports
ScriptedAlchemy c110b7c
enable nested imports
ScriptedAlchemy aff0685
enable full demo imports
ScriptedAlchemy 29c234c
feat: support lazy compilation
ScriptedAlchemy 7f253f1
feat: prefer host modules for next and react
ScriptedAlchemy 2bee364
Add TS modules for sample Next apps
RussellCanfield 105c124
fix: remove hard coded share scope
ScriptedAlchemy f0d7671
fix: dont crash offline remotes
ScriptedAlchemy 635c035
Merge remote-tracking branch 'origin/next_byte_implementation' into n…
ScriptedAlchemy 12ff71c
chore: patching changes from next branch
ScriptedAlchemy e05d32f
fix: remote global share scope
ScriptedAlchemy d3aa2e7
Merge pull request #1433 from module-federation/next_byte_implementation
ScriptedAlchemy f95e23f
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 5b8eed3
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy d821562
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 1d65335
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy c8daa8c
chore: fix dep tracking
ScriptedAlchemy f4843ec
fix: resupport delegate modules
ScriptedAlchemy 9b27e63
Merge pull request #1464 from module-federation/delegate_module_reimp…
ScriptedAlchemy 53ad509
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy 40b8c28
fix: remove logging on DFS
ScriptedAlchemy 347e4c9
fix: legacy scope duplication on recreation
ScriptedAlchemy ac0efa3
fix: improve backward compat __remote_scope__ global
ScriptedAlchemy 6e7974c
fix: Ts import error
ScriptedAlchemy 1c5c6a8
fix: server sharing
ScriptedAlchemy d14324a
fix: use ES5 for renderStartup of entrypoint
ScriptedAlchemy 00227ca
feat: AsyncBoundaryPlugin
ScriptedAlchemy e7fada2
fix: broken versioning issues in consumes
ScriptedAlchemy 8eea1a8
fix: improve logic in runtime module info proxy
ScriptedAlchemy 8a1800d
refactor: use noop to include shared next modules
ScriptedAlchemy c36ffc4
refactor: import async Boundary plugin (enhanced)
ScriptedAlchemy a50dae8
fix: add styled-jsx to internal share
ScriptedAlchemy f4b0386
feat: share next/image
ScriptedAlchemy d86dcde
fix: improve image loader public path calc
ScriptedAlchemy 6098fee
fix: enable path fixes again
ScriptedAlchemy 2f9e14b
fix: enable path fixes
ScriptedAlchemy 3436892
fixL remove duplicate next/image share key
ScriptedAlchemy a3eb553
feat: checkInvalidContext as tapable hook
ScriptedAlchemy ae890d5
fix: ensure sharing of react/jsx runtime and dev runtime
ScriptedAlchemy 0a07481
fix: typescript issues
ScriptedAlchemy b20ded1
convert DFS to Typescript
ScriptedAlchemy 72d5554
chore: fix builds
ScriptedAlchemy 8f8481b
Merge branch 'node-sync-bytedance' into tappable_async_boundary
ScriptedAlchemy 1e325a6
fix: set requiredVersion to false on utils
ScriptedAlchemy 99b79b5
style:lint source
ScriptedAlchemy 0de03e4
Merge pull request #1470 from module-federation/tappable_async_boundary
ScriptedAlchemy c1db325
fix: stats plugin updates
ScriptedAlchemy 99f733b
fix: hot reloading system
ScriptedAlchemy c9df545
fix: chunk flushing
ScriptedAlchemy 6e16fa1
Change swc interop to false so it defaults to swc interop helper (imp…
RussellCanfield 180cb8f
Fix remaining import requires
RussellCanfield 37458b7
Merge pull request #1474 from module-federation/rcanfield-node-sync-b…
ScriptedAlchemy 1a436c4
chore: add release tasks to enhanced
ScriptedAlchemy 5e06962
Merge branch 'main' into node-sync-bytedance
ScriptedAlchemy ef8e403
chore: set basebranch
ScriptedAlchemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import type { Chunk, Compiler } from 'webpack'; | ||
import type { Chunk, Compiler, Compilation, ChunkGraph } from 'webpack'; | ||
import type { ModuleFederationPluginOptions } from '../types'; | ||
import RuntimeGlobals from 'webpack/lib/RuntimeGlobals'; | ||
import StartupChunkDependenciesPlugin from 'webpack/lib/runtime/StartupChunkDependenciesPlugin'; | ||
import ChunkLoadingRuntimeModule from './LoadFileChunkLoadingRuntimeModule'; | ||
import FederationModuleInfoRuntimeModule from './FederationModuleInfoRuntimeModule'; | ||
|
||
interface CommonJsChunkLoadingOptions extends ModuleFederationPluginOptions { | ||
baseURI: Compiler['options']['output']['publicPath']; | ||
|
@@ -34,7 +35,7 @@ class CommonJsChunkLoadingPlugin { | |
|
||
compiler.hooks.thisCompilation.tap( | ||
'CommonJsChunkLoadingPlugin', | ||
(compilation) => { | ||
(compilation: Compilation) => { | ||
// Always enabled | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const isEnabledForChunk = (_: Chunk) => true; | ||
|
@@ -44,67 +45,88 @@ class CommonJsChunkLoadingPlugin { | |
if (onceForChunkSet.has(chunk)) return; | ||
|
||
onceForChunkSet.add(chunk); | ||
|
||
if (!isEnabledForChunk(chunk)) return; | ||
|
||
if (!isEnabledForChunk(chunk)) { | ||
return; | ||
} | ||
set.add(RuntimeGlobals.moduleFactoriesAddOnly); | ||
set.add(RuntimeGlobals.hasOwnProperty); | ||
|
||
set.add(RuntimeGlobals.publicPath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes import.meta which breaks node auto path There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @2heal1 I think it's this which breaks other pr where public path is auto. |
||
compilation.addRuntimeModule( | ||
chunk, | ||
new ChunkLoadingRuntimeModule(set, this.options, { | ||
webpack: compiler.webpack, | ||
}) | ||
); | ||
}; | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.ensureChunkHandlers) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.hmrDownloadUpdateHandlers) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.hmrDownloadManifest) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.baseURI) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.externalInstallChunk) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.onChunksLoaded) | ||
.tap('CommonJsChunkLoadingPlugin', handler); | ||
|
||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.ensureChunkHandlers) | ||
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => { | ||
if (!isEnabledForChunk(chunk)) return; | ||
set.add(RuntimeGlobals.getChunkScriptFilename); | ||
}); | ||
|
||
.tap( | ||
'CommonJsChunkLoadingPlugin', | ||
(chunk: Chunk, set: Set<string>) => { | ||
if (!isEnabledForChunk(chunk)) { | ||
return; | ||
} | ||
set.add(RuntimeGlobals.getChunkScriptFilename); | ||
} | ||
); | ||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.hmrDownloadUpdateHandlers) | ||
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => { | ||
if (!isEnabledForChunk(chunk)) return; | ||
set.add(RuntimeGlobals.getChunkUpdateScriptFilename); | ||
set.add(RuntimeGlobals.moduleCache); | ||
set.add(RuntimeGlobals.hmrModuleData); | ||
set.add(RuntimeGlobals.moduleFactoriesAddOnly); | ||
}); | ||
|
||
.tap( | ||
'CommonJsChunkLoadingPlugin', | ||
(chunk: Chunk, set: Set<string>) => { | ||
if (!isEnabledForChunk(chunk)) { | ||
return; | ||
} | ||
set.add(RuntimeGlobals.getChunkUpdateScriptFilename); | ||
set.add(RuntimeGlobals.moduleCache); | ||
set.add(RuntimeGlobals.hmrModuleData); | ||
set.add(RuntimeGlobals.moduleFactoriesAddOnly); | ||
} | ||
); | ||
compilation.hooks.runtimeRequirementInTree | ||
.for(RuntimeGlobals.hmrDownloadManifest) | ||
.tap('CommonJsChunkLoadingPlugin', (chunk, set) => { | ||
if (!isEnabledForChunk(chunk)) return; | ||
set.add(RuntimeGlobals.getUpdateManifestFilename); | ||
}); | ||
.tap( | ||
'CommonJsChunkLoadingPlugin', | ||
(chunk: Chunk, set: Set<string>) => { | ||
if (!isEnabledForChunk(chunk)) { | ||
return; | ||
} | ||
set.add(RuntimeGlobals.getUpdateManifestFilename); | ||
} | ||
); | ||
|
||
compilation.hooks.additionalTreeRuntimeRequirements.tap( | ||
'StartupChunkDependenciesPlugin', | ||
( | ||
chunk: Chunk, | ||
set: Set<string>, | ||
{ chunkGraph }: { chunkGraph: ChunkGraph } | ||
) => { | ||
compilation.addRuntimeModule( | ||
chunk, | ||
//@ts-ignore | ||
new FederationModuleInfoRuntimeModule() | ||
); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
packages/node/src/plugins/FederationModuleInfoRuntimeModule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
const { RuntimeGlobals } = require('webpack'); | ||
const { RuntimeModule } = require('webpack'); | ||
const { Template } = require('webpack'); | ||
|
||
class FederationModuleInfoRuntimeModule extends RuntimeModule { | ||
constructor() { | ||
super('federation module info runtime', RuntimeModule.STAGE_BASIC + 1); | ||
} | ||
|
||
/** | ||
* @returns {string} runtime code | ||
*/ | ||
// eslint-disable-next-line max-lines-per-function | ||
generate() { | ||
return Template.asString([ | ||
`${RuntimeGlobals.require}.federation = {`, | ||
Template.indent([`cache: {},`, `remotes: {},`, `moduleInfo: {},`]), | ||
`}`, | ||
]); | ||
} | ||
} | ||
|
||
export default FederationModuleInfoRuntimeModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may no longer be appliciable, will have to check