asciidoctor.js
asciidoctor.js copied to clipboard
Is there any temporary solution to this? I am unable to use `@asciidoctor/core` with Svelte
Is there any temporary solution to this? I am unable to use @asciidoctor/core with Svelte
Code:
<script>
export let content;
import Asciidoctor from '@asciidoctor/core';
const processor = Asciidoctor();
let rendered;
$: rendered = processor.convert(content)
</script>
Getting the following error in the console:
Uncaught TypeError: "length" is read-only asciidoctor.js:1869:4
node_modules @asciidoctor_core.js:1055
node_modules @asciidoctor_core.js:1766
node_modules @asciidoctor_core.js:2319
node_modules @asciidoctor_core.js:1363
node_modules @asciidoctor_core.js:1384
node_modules @asciidoctor_core.js:3789
node_modules @asciidoctor_core.js:1363
node_modules @asciidoctor_core.js:1384
node_modules @asciidoctor_core.js:15879
node_modules @asciidoctor_core.js:15889
__require2 chunk-IHTDASF6.js:17
<anonymous> @asciidoctor_core:1
asciidoctor.js:1869:4
alias asciidoctor.js:1869
node_modules/@asciidoctor/core/dist/browser/asciidoctor.js/Opal.modules["corelib/module"]/< asciidoctor.js:2809
"corelib/module" asciidoctor.js:3558
load asciidoctor.js:2314
require asciidoctor.js:2342
"opal/base" asciidoctor.js:5469
load asciidoctor.js:2314
require asciidoctor.js:2342
js asciidoctor.js:20069
js asciidoctor.js:20079
__require2 chunk-IHTDASF6.js:17
<anonymous> @asciidoctor_core:1
InnerModuleEvaluation self-hosted:2381
InnerModuleEvaluation self-hosted:2381
InnerModuleEvaluation self-hosted:2381
InnerModuleEvaluation self-hosted:2381
InnerModuleEvaluation self-hosted:2381
evaluation self-hosted:2332
Originally posted by @b177y in https://github.com/asciidoctor/asciidoctor.js/issues/686#issuecomment-916854429
I'm not familiar with Svelte but the only workaround is to remove/disable the strict mode: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
I tried it in Vue(packaged by Vite) and the same error shows up. I think the problem is that Asciidoctor.js is not compatible with Vite.
It will be fixed in Asciidoctor.js 3.x