Closed uetkaje closed 1 day ago
The reason this is happening is because the Prism grammar is not included in the JavaScript sent to the client. It seems like only modules referenced in the useVisibleTask$
callback are included in the client bundle. Since the Prism grammar isn't referenced here, it won't be included in the chunk sent to the browser. One way to fix this is create another module that is dynamically imported in useVisibleTask$
.
useVisibleTask$(() => {
import('./addWebComponent');
});
In addWebComponent.ts
, include the same code that's in useVisibleTask$
from your example, and import the Prism grammar. This isn't a great solution though since the editor will load slower. I haven't used Qwik, and there might be a better solution for defining what to run in the browser.
It works. Thank you so much.
Hi,
I try to use Prism code editor in Qwik app. It occurs grammar error for java script while editor initializing.
Simple example on Stackblitz.
Any solution?
Thanks, Emre