Skip to content
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

Vue Slot Component Causes "Cannot Read Properties of Null (reading 'ce')" Error When Rendering #13073

Closed
Kaifuny opened this issue Mar 19, 2025 · 2 comments

Comments

@Kaifuny
Copy link

Kaifuny commented Mar 19, 2025

Vue version

3.5.13

Link to minimal reproduction

https://github.com/Kaifuny/test-vue-slot-component-package

Steps to reproduce

GitHub Repo: https://github.com/Kaifuny/test-vue-slot-component-package

yarn install

yarn build:ui

yarn dev

when you at the root of the app project

apps/desktop/src/App.vue

<script setup lang="ts">
import { Button1, Button2 } from '@test/ui';
</script>

<template>
  <div>
    <!-- <Button1></Button1> -->
    <Button2>bbb</Button2>
  </div>
</template>

Button2 is not working, but Button1 is working.

the error message is

index.mjs:618 Uncaught TypeError: Cannot read properties of null (reading 'ce')
    at renderSlot (index.mjs:618:32)
    at Proxy._sfc_render (index.mjs:1262:5)
    at renderComponentRoot (chunk-3SZSTCRY.js?v=05012731:8581:17)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-3SZSTCRY.js?v=05012731:7403:46)
    at ReactiveEffect.run (chunk-3SZSTCRY.js?v=05012731:481:19)
    at setupRenderEffect (chunk-3SZSTCRY.js?v=05012731:7538:5)
    at mountComponent (chunk-3SZSTCRY.js?v=05012731:7313:7)
    at processComponent (chunk-3SZSTCRY.js?v=05012731:7266:9)
    at patch (chunk-3SZSTCRY.js?v=05012731:6782:11)
    at mountChildren (chunk-3SZSTCRY.js?v=05012731:7014:7)

What is expected?

should render correctly without throwing an error, just like . Both components should be usable when imported from @test/ui in App.vue.

What is actually happening?

index.mjs:618 Uncaught TypeError: Cannot read properties of null (reading 'ce')
    at renderSlot (index.mjs:618:32)
    at Proxy._sfc_render (index.mjs:1262:5)
    at renderComponentRoot (chunk-3SZSTCRY.js?v=05012731:8581:17)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-3SZSTCRY.js?v=05012731:7403:46)
    at ReactiveEffect.run (chunk-3SZSTCRY.js?v=05012731:481:19)
    at setupRenderEffect (chunk-3SZSTCRY.js?v=05012731:7538:5)
    at mountComponent (chunk-3SZSTCRY.js?v=05012731:7313:7)
    at processComponent (chunk-3SZSTCRY.js?v=05012731:7266:9)
    at patch (chunk-3SZSTCRY.js?v=05012731:6782:11)
    at mountChildren (chunk-3SZSTCRY.js?v=05012731:7014:7)

System Info

System:
    OS: macOS 15.4
    CPU: (10) arm64 Apple M1 Max
    Memory: 347.48 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 23.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.1.0 - /opt/homebrew/bin/npm
    bun: 1.2.3 - ~/.bun/bin/bun
Browsers:
    Chrome: 134.0.6998.89
    Safari: 18.4

Any additional comments?

No response

@linzhe141
Copy link
Contributor

When you create a component library, you should exclude vue when building

   target: "esnext",
   outDir: "dist",
   emptyOutDir: true,
   minify: false,
+  rollupOptions: {
+     external: ["vue"],
+  },

@Kaifuny
Copy link
Author

Kaifuny commented Mar 19, 2025

@Kaifuny Kaifuny closed this as completed Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants