Skip to content

Commit

Permalink
chore: use mfv2 formate entry
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 committed Jul 12, 2024
1 parent 43c6d34 commit f37d43e
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions apps/runtime-demo/3005-runtime-host/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => {
name: 'runtime_host',
remotes: {
// remote2: 'runtime_remote2@http://localhost:3007/remoteEntry.js',
// remote1: 'runtime_remote1@http://127.0.0.1:3006/mf-manifest.json',
remote1: `promise new Promise((resolve)=>{
const raw = 'runtime_remote1@http://127.0.0.1:3006/remoteEntry.js'
const [_, remoteUrlWithVersion] = raw.split('@')
const script = document.createElement('script')
script.src = remoteUrlWithVersion
script.onload = () => {
const proxy = {
get: (request) => window.runtime_remote1.get(request),
init: (arg) => {
try {
return window.runtime_remote1.init(arg)
} catch(e) {
console.log('runtime_remote1 container already initialized')
}
}
}
resolve(proxy)
}
document.head.appendChild(script);
remote1: 'runtime_remote1@http://127.0.0.1:3006/mf-manifest.json',
// remote1: `promise new Promise((resolve)=>{
// const raw = 'runtime_remote1@http://127.0.0.1:3006/remoteEntry.js'
// const [_, remoteUrlWithVersion] = raw.split('@')
// const script = document.createElement('script')
// script.src = remoteUrlWithVersion
// script.onload = () => {
// const proxy = {
// get: (request) => window.runtime_remote1.get(request),
// init: (arg) => {
// try {
// return window.runtime_remote1.init(arg)
// } catch(e) {
// console.log('runtime_remote1 container already initialized')
// }
// }
// }
// resolve(proxy)
// }
// document.head.appendChild(script);

})`,
// })`,
},
// library: { type: 'var', name: 'runtime_remote' },
filename: 'remoteEntry.js',
Expand Down

0 comments on commit f37d43e

Please sign in to comment.