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
// eslint-disable-next-line import/no-unresolved | |
import { baz } from 'module1/baz'; | |
export async function foo() { | |
return `foo + ${await baz()}`; | |
} |
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
let counter = 3; | |
export async function baz() { | |
if (counter <= 0) { | |
return 'end'; | |
} | |
// eslint-disable-next-line import/no-unresolved | |
const { foo } = await import('app1/foo'); |
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
import * as React from 'react'; | |
import { Text } from 'react-native'; | |
// eslint-disable-next-line import/no-unresolved | |
import Module1 from 'module1/Root'; | |
import { foo } from './foo'; | |
export default function App() { | |
const [fooText, setFooText] = React.useState<string>(''); |
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
// eslint-disable-next-line import/no-extraneous-dependencies | |
import { Federated } from '@callstack/repack/client'; | |
import React from 'react'; | |
import { Text, SafeAreaView } from 'react-native'; | |
const App1 = React.lazy(() => Federated.importModule('app1', './App')); | |
const App2 = React.lazy(() => Federated.importModule('app2', './App')); | |
export default function App() { | |
return ( |
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
ScriptManager.shared.addResolver(async (scriptId, caller) => { | |
let url; | |
const containers = await fetchURLs(); | |
const resolveURL = Federated.createURLResolver({ | |
containers, | |
}); | |
if (caller === 'main') { | |
url = Script.getDevServerURL(scriptId); | |
} else { |
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
const resolveURL = Federated.createURLResolver({ | |
containers: { | |
app1: 'http://localhost:9000/[name][ext]', | |
app2: 'http://localhost:9001/[name][ext]', | |
module1: 'http://localhost:9002/[name][ext]', | |
}, | |
}); | |
ScriptManager.shared.addResolver(async (scriptId, caller) => { | |
let url; |
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
new Repack.plugins.ModuleFederationPlugin({ | |
name: 'module1', | |
exposes: { | |
'./Root': './src/Root.tsx', | |
'./baz': './src/baz.ts', | |
}, | |
shared: { | |
react: { | |
...Repack.Federated.SHARED_REACT, | |
eager: STANDALONE, |
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
new Repack.plugins.ModuleFederationPlugin({ | |
name: 'app1', | |
exposes: { | |
'./App': './src/App.tsx', | |
'./Text': './src/Text.tsx', | |
'./foo': './src/foo.ts', | |
}, | |
shared: { | |
react: { | |
...Repack.Federated.SHARED_REACT, |
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
new Repack.plugins.ModuleFederationPlugin({ | |
name: 'host', | |
shared: { | |
react: { | |
...Repack.Federated.SHARED_REACT, | |
requiredVersion: '17.0.2', | |
}, | |
'react-native': { | |
...Repack.Federated.SHARED_REACT_NATIVE, | |
requiredVersion: '0.68.2', |
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
const handlePayPress = async () => { | |
// step 1 | |
// step 2 | |
// step 3 | |
if (error) { | |
// Handle error | |
} else if (paymentIntent) { | |
// Handle success | |
} | |
}; |
NewerOlder