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 3 SSR Support #24

Open
arneesh opened this issue Oct 9, 2021 · 6 comments
Open

Vue 3 SSR Support #24

arneesh opened this issue Oct 9, 2021 · 6 comments

Comments

@arneesh
Copy link

arneesh commented Oct 9, 2021

Does this library have inbuilt SSR support for Vue 3? It is working well on client-side, but when I ran SSR production build I got Vue reference error (added screenshot below). I also tried wrapping it in a no-ssr tag but I am still getting the error.

          <no-ssr>
                  <highlightjs
                    style="white-space: pre-wrap"
                    language="javascript"
                    :code="code"
                  />
          </no-ssr>

Is there a know way to handle it handle the SSR issue if it isn't being handled internally in this package?
The bundler that I am using is webpack

136668908-9f5259f9-c845-4619-99f3-cfea8ec64b90

@joshgoebel
Copy link
Member

I'd guess not, but I'm not certain.

@Trinovantes
Copy link
Contributor

This plugin doesn't include a commonjs build. Your bundler is using dist/highlightjs-vue.min.js (for web browsers only) instead of dist/highlightjs-vue.esm.min.js.

Also you forgot to hide your file path on the last 2 lines of your traceback 👀

@Backru
Copy link

Backru commented Jan 23, 2024

这个插件 是不是不支持vue3啊 在开发时没问题 到了打包生成部署时 就报错 说什么Cannot set property HighlightJS of # which has only a getter

@ChrisNi888
Copy link

这个插件 是不是不支持vue3啊 在开发时没问题 到了打包生成部署时 就报错 说什么Cannot set property HighlightJS of # which has only a getter

请问后来解决了吗?我也遇到这个问题

@Backru
Copy link

Backru commented Aug 25, 2024

这个插件 是不是不支持vue3啊 在开发时没问题 到了打包生成部署时 就报错 说什么Cannot set property HighlightJS of # which has only a getter

请问后来解决了吗?我也遇到这个问题

解决了 把版本降低就好了 两个插件同时降低

@ChrisNi888
Copy link

这个插件 是不是不支持vue3啊 在开发时没问题 到了打包生成部署时 就报错 说什么Cannot set property HighlightJS of # which has only a getter

请问后来解决了吗?我也遇到这个问题

解决了 把版本降低就好了 两个插件同时降低

谢谢,我后来改用prismjs代替了,要是有问题再尝试HighlightJS。

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

5 participants