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

Custom SFC blocks #52

Closed
Hebilicious opened this issue Jul 8, 2023 · 4 comments
Closed

Custom SFC blocks #52

Hebilicious opened this issue Jul 8, 2023 · 4 comments

Comments

@Hebilicious
Copy link

Hello there ! Thanks for making Volar, it is really awesome.

I want to implement server blocks for Nuxt nuxt/nuxt#20802
The SFC is going to look like this.

Under the hood, this entire block content would be removed, and processed separately by Nuxt. It wouldn't be present in the component itself, it's essentially isolated from blocks.

Adding lang="ts" make the color syntax work, but I want all the Typescript features to work, such as following the correct tsconfig and also typechecking.
I've considered using a <script server> tag too, but it seems to be easier with a custom name.
What needs to happen with Volar to make something like this work ? I would appreciate if you could point me in the right direction.
Thanks !

@Hebilicious
Copy link
Author

Hebilicious commented Jul 12, 2023

I've created a nuxt module that use custom blocks.

https://github.com/Hebilicious/server-block-nuxt

@johnsoncodehk
Copy link
Member

hey @Hebilicious, please note that @volar/vue-langauge-core is renamed to @vue/language-core.

https://github.com/Hebilicious/server-block-nuxt/blob/main/packages/sfc-server-volar/package.json#L41

@Hebilicious
Copy link
Author

hey @Hebilicious, please note that @volar/vue-langauge-core is renamed to @vue/language-core.

Hebilicious/server-block-nuxt@main/packages/sfc-server-volar/package.json#L41

Thanks, I've updated. I haven't been able to understand why defaults exports can't be used in my custom blocks though.

@johnsoncodehk
Copy link
Member

You should use export = or module.exports = instead of export default.

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