-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'isCE' of null in remote component with slot using Module Federation #4344
Comments
That's because you have two distinct copies of the Vue package being used, one in each package. Vue uses a global singleton to track the current rendering instance - having more than one copy included will inevitably lead to such issues. Solution: configure project in a way that Al packages use that same package. In yarn workspaces, this would work fine because Vue would be hoistws to the root's node_modules. |
Sounds legit, thanks! |
Yep, that definitely helped. Thank you @LinusBorg :) |
@fatawesome could you please tell us what was the solution? I am facing the same problem and I don't know how to not conflict the two distinct copies of the Vue package. Thanks |
Same here; I have not found a way to work around this issue. I made sure that both packages were using the same Vue version (matching versions and hashes in their |
Got the same issue. With vue 2 everything worked fine. Versions of vue and any other dependencies are exact the same and I use npm atm. |
Using the npm link is the primary reason as the host application would try to use the vue from the linked library. Add these two lines to the vue.config.js of the host application.
Refer to: #2064 (comment) |
use webpack resolve vue to one package reference. |
Hi, I am building a library with vue3 and vite, when i use the library if i use slot i got same issue, i tried the solutions in this thread but i can not fix the issue. error: My vite config.js:
|
@rhmkstk add this to your vite.config.ts
|
if you build with rollup. please add "external: ["vue"]" in build config file.like this: |
did you solve this problem? |
I have 2 ideas that you can try. (1) config vite ssr。 like this: (2)or, write a single file to use rollup build. |
Hello, thanks for your answer, after i try several solution i reintall project with newer vite version and it fix the issue |
After revising the same issue this week, this actual resolved the issue in a component-library and npm link scenario |
Adding the |
I solved. |
how do I do that? |
@huntJs I have the same exact problem, so please report back if you make progress |
nice dude |
I had this issue when trying to build a vue3 project with a library imported as a submodule. I solved this by:
Then my submodule components used in my root project worked without this error. Maybe all these steps weren't necessarily needed; I would be interested to know if I my solution could be improved. |
Brother, have you solved it? The micro front end I tested also encountered this problem. When the father and son are vite + vue3 first load no problem, the switch encountered this situation, if you finally solve it, please tell me |
Same problem with custom UI library built with Vite and Vue 3 which I'm trying to use in my Nuxt app. The error is in the component which uses onMounted() hook:
Maybe this warns are not related, but when I don't import this exact component, everything is fine. None of the solutions above helps :( |
why this has been closed even if the error happen all the time ? we should have hard tests on that as it seems people have it a lot when using module federation or library components none of the solutions works unfortunately with latest vue version + vite 4 |
'isCE' happen because which has two differece vue verdion. you can try use 'external' to exclude another vue in components. |
@flozero You can try this config set at vue@3.2.x and vite@4 {
resolve: {
alias: {
vue: path.resolve('your current vue folder', 'dist', 'vue.runtime.esm-bundler.js')
}
}
} I am set this config solved my problem. |
Take care what internal method from @vue/core you are using. In my case, I used the helper |
For me the error disappeared when I installed the dependency in the root project with |
解决了嘛 我是这样写的还是报错 Cannot read properties of null (reading 'isCE') |
Version
3.2.2
Reproduction link
https://github.com/fatawesome/vue-next-isce-issue
Steps to reproduce
Clone the repository, from root run
yarn && lerna bootstrap && yarn start
.Navigate to http://localhost:3000.
What is expected?
On the page you should see two lines of text:
What is actually happening?
Server crashes on
renderSlot
function withCannot read property 'isCE' of null
error.Removing slot from remote component fixes the issue, but obviously we need slots in our code :)
Issue appears when building application on Module Federation architecture. We also use @telenko/node-mf package to fetch code in a universal manner, but I believe this lib cannot be a problem.
The text was updated successfully, but these errors were encountered: