Comments (6)
There are currently 2 solutions. First, you can set the build.target
to specified browsers.
build: {
target: ["chrome89", "edge89", "firefox89", "safari15"],
},
Another option is use plugin vite-plugin-top-level-await
.
import federation from '@originjs/vite-plugin-federation'
import topLevelAwait from 'vite-plugin-top-level-await'
export default defineConfig({
plugins: [
federation({
...
}),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: i => `__tla_${i}`
})
],
build: {
target:"es2015"
}
})
from vite-plugin-federation.
This might be one of the issues to consider, maybe try using then instead of top-level await, but I'm not sure if that would cause some weird problems
from vite-plugin-federation.
Having the same issue when I try to use terser
instead of esbuild
. I had to disable this plugin infortunately, while keeping subscribed to this thread.
from vite-plugin-federation.
Having the same issue, is there any progress there?
from vite-plugin-federation.
Since the solution already exists, close
from vite-plugin-federation.
It seems this issue is not resolved in v 1.1.6. I am able to shim top level await but with build target es2015
I get the following error and the styles for my remote are indeed not applied.
The remote style takes effect only when the build.target option in the vite.config.ts file is higher than that of "es2020".
(anonymous) @ instrument.js:111
d @ remoteEntry.js:1
./microfrontend @ remoteEntry.js:1
h @ remoteEntry.js:1
(anonymous) @ routes.ts:797
Is it possible to use this plugin with a build target below es2020
?
from vite-plugin-federation.
Related Issues (20)
- Shared works only for top level imports HOT 10
- ERROR: Expression Expected - Unable to understand this error
- Mutliple WS connections established to the remote app
- Adding and then removing `manualChunks` causes runtime error
- flattenModule breaks dependencies HOT 1
- exporting variables from the shared module, the variables within the shared module appear as undefined HOT 1
- module federation react typescript webpack and vite throws an error "Loading script failed." HOT 2
- Vue2.7, Vite host with webpack remote, "shared" create undefiend paramter(with Reproduction project)
- 【example demo bug】Did not work as expected when using the sample demo HOT 3
- 【bug】vue3-demo-esm-shared-store running __federation_shared_myStore-ed6e87a0.js 404
- Module Federation + base url HOT 3
- Vite Module Federation CORS error HOT 4
- Do something like @module-federation/typescript? HOT 2
- Error: Minified React error #321; HOT 5
- Enable CORS by including credentials when fetching Remotes on other Domains
- Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL HOT 2
- Shared dependencies is loaded sequentially
- React module federation gives __federation_shared_react-dom-6fc2ee8d.js:224 TypeError: Cannot read properties of null (reading 'useContext') at react_production_min.useContext (__federation_shared_react-af90d75c.js:59:144) HOT 6
- [MaterialUI] Cannot read properties of null (reading 'useContext')
- Is this project abandonned HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-federation.