-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: introducing vercel deployments #18 * chore: trying multiple vercel.json * chore: going back to classic * fix: add html deployment * fix: lint * fix: lint * fix: expose a factory * fix: expose a promise which returns a factory
- Loading branch information
1 parent
94875f1
commit 60629ee
Showing
9 changed files
with
293 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<html> | ||
<head> | ||
<title>Module Federation Experiments</title> | ||
<script type="module"> | ||
const sharedScope = { | ||
/** | ||
* In the base-example, we have declared uuid as import: false | ||
* So we provide a fallback by directly registering it with the shared scope object. | ||
*/ | ||
uuid: { | ||
'1.0.0': { | ||
get: () => () => Promise.resolve({ v4: { mock: 'uuid' } }), | ||
}, | ||
}, | ||
}; | ||
|
||
globalThis.sharedScope = sharedScope; | ||
|
||
const basePath = window.location.href.slice( | ||
0, | ||
window.location.href.lastIndexOf('/'), | ||
); | ||
const remoteEntryUrl = `${basePath}/my-remote-entry.js`; | ||
const container = await import(remoteEntryUrl); | ||
|
||
console.log('doing container.init()'); | ||
await container.init(sharedScope); | ||
console.log('shared scope: ', JSON.stringify(sharedScope, null, 2)); | ||
|
||
console.log("doing container.get('./react')"); | ||
const react = (await container.get('./react'))(); | ||
console.log('exposed module ./react: ', react); | ||
console.log('shared scope: ', JSON.stringify(sharedScope, null, 2)); | ||
|
||
console.log("doing container.get('./index')"); | ||
const index = (await container.get('./index'))(); | ||
console.log('exposed module ./index', index); | ||
</script> | ||
</head> | ||
<body> | ||
<h3>View page source to see what's happening</h3> | ||
<h3>Open JS console to see logs.</h3> | ||
<h4> | ||
Type globalThis.shareScope in the JS console to check the current state of | ||
shared scope object. | ||
</h4> | ||
</body> | ||
</html> |
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
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
Oops, something went wrong.