Open vcoppe opened 7 months ago
same issue here. :(
Examining the imported module with console.log(mk)
yields
{ default: [Function: default_1] }
which hints that this is due to the interaction between CommonJS and ES modules. From the Node.js documentation:
When importing CommonJS modules, the module.exports object is provided as the default export.
Simply replace mk
with mk.default
to access the plugin function. See here for an example.
I suspect this issue is due the choice of module output format by the Typescript compiler. If your compiler emits ES modules , then the above should apply. However, if the module format is CommonJS, then adding .default
should not be necessary. For example, when adding this package as a plugin to Vite, you will need to use the .default
syntax since the actual runtime script vite.js
is compiled as an ES module.
Hi, I am trying to import and use this plugin in a Svelte project as shown below
but cannot avoid the following error
Here is a minimal reproducible example: https://svelte.dev/repl/fea74f54d05c4632ac61e2e7d46df355?version=4.2.12.
Note that this error does not occur with other versions of this plugin (iktakahiro/markdown-it-katex or traPtitech/markdown-it-katex). Do you know what could cause this?