core: Cannot read property 'isCE' of null in remote component with slot using Module Federation
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:
- Host content
- test remote component
What is actually happening?
Server crashes on renderSlot function with Cannot 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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 13
- Comments: 32 (1 by maintainers)
Commits related to this issue
- switching to vite !! + umd support -- #137 https://github.com/vuetifyjs/vuetify/discussions/4068#discussioncomment-1357093 https://github.com/vuejs/core/issues/4344#issuecomment-1023220225 — committed to fritx/vue-at by fritx 2 years ago
- switching to vite !! + umd support -- #137 https://github.com/vuetifyjs/vuetify/discussions/4068#discussioncomment-1357093 https://github.com/vuejs/core/issues/4344#issuecomment-1023220225 — committed to fritx/vue-at by fritx 2 years ago
- switching to vite !! + umd support -- #137 https://github.com/vuetifyjs/vuetify/discussions/4068#discussioncomment-1357093 https://github.com/vuejs/core/issues/4344#issuecomment-1023220225 — committed to fritx/vue-at by fritx 2 years ago
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.
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: https://github.com/vuejs/vue-next/issues/2064#issuecomment-797365133
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:
Uncaught TypeError: Cannot read properties of null (reading 'isCE')My vite config.js:
@rhmkstk add this to your vite.config.ts
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) }, dedupe: ['vue'], // this line }Adding the
dedupe: ['vue']to my vite.config.js solve the problem. Thanks!I had this issue when trying to build a vue3 project with a library imported as a submodule.
I solved this by:
yarn.lockfiles from both root project and submodulenode_modulesfrom both root project and submoduledistdirectory from both root project and submodulepackage.jsonwithin my submodule (I had Vue set as a dependency in my submodule)3.2.37 in my case)['vue']toresolve.dedupeto myvite.config.jsfile in the root project. For completeness, here is my vite config file:yarn installthenyarn buildin both root project and submoduleThen 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.
@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
@huntjs I have the same exact problem, so please report back if you make progress
if you build with rollup. please add âexternal: [âvueâ]â in build config file.like this:
export default { ... external: [ "vue" ], ... }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
package-lock.jsonfiles) and the'isCE' of nullerror is still persisting. I also tried disabling symlink resolution fornode_modules, and that had no effect either.I also met the same issue, the parent Application(vue3+vite2.0) share some common component to child Application, but if the common component exist slot , the child Application will throw an exception( vue3+ webpack5),
In parent Application, i had config below

so who can help me to slove this problem
After revising the same issue this week, this actual resolved the issue in a component-library and npm link scenario
use webpack resolve vue to one package reference.