Replies: 2 comments 4 replies
-
This is possible, but first we want to clarify the advantages of ESM over webpackChunks. The webpack runtime is good at organising the loading and execution of chunks, which is crucial for web applications. I’m not sure that ESM is capable of fully equivalent behavior. |
Beta Was this translation helpful? Give feedback.
4 replies
-
Config: export default defineConfig({
// ...
tools: {
rspack: {
experiments: {
outputModule: true,
},
},
},
moduleFederation: {
options: {
name: 'remote',
exposes: {
'./Button': './src/Button',
},
filename: 'remoteEntry.js',
library: {
type: 'module',
},
// ...
},
},
}) Use: import('http://localhost:3002/remoteEntry.js').then(async (res) => {
const moduleButton = (await res.get('./Button'))()
console.log(moduleButton) // __esModule
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I want to use ESM in my browser
How can I get
<script type="module" />
(like vite), instead of webpackChunk?Beta Was this translation helpful? Give feedback.
All reactions