Build fails due to custom directive missing an SSR Transform
See original GitHub issueDescribe the bug
Adding a simple directive inside a markdown file or an SFC throws an error during the build. Seems like ClientOnly component does not exist yet in VitePress.
Custom directive is missing corresponding SSR transform and will be ignored.
To Reproduce
<div v-test>test</div>
<script>
export default {
directives: {
test: {
mounted(el, binding) {
console.log(el)
}
}
}
}
</script>
Expected behavior Build should work even though an SSR implementation for the custom directive doesn’t exist.
System Info
- vitepress version: 0.6.0
- vite version: v1.0.0-rc.4
- Node version: 12.18.3
- OS version: Catalina 10.15.6
Additional context None.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:22 (9 by maintainers)
Top Results From Across the Web
How to make custom directive in Vue.js 3? - Stack Overflow
I got error like "Cannot read property 'created' of undefined" in console. And nothing is displayed. createApp is missing, I editted my question ......
Read more >Directive SSR Transform - Get Help - Vue Forum
I've been looking around to try and see how to implement an SSR Transform for a custom directive, it seems that VuePress (i...
Read more >Missing @Directive()/@Component() decorator migration
This migration adds an empty @Directive() decorator to undecorated base classes that: Use Angular features; Are extended by directives or components.
Read more >Docs • Svelte
SvelteKit will handle calling the Svelte compiler to convert your .svelte files ... With this, npm run build will generate HTML, JS and...
Read more >Angular Universal: Complete Practical Guide
Implementing a fine-grained Application shell using custom structural directives; Leveraging the Angular State Transfer API; Code Sample (Github ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A temporary fix:
https://github.com/vueuse/patch-vue-directive-ssr
v3 SSR docs are not fully complete yet, so for now you’ll have to read the types here: https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/transform.ts#L56
ClientOnly is implemented in 8809d2d and will be available in the next release.