From 345bc7c848a3160f7d69564d47c655db70076429 Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Mon, 18 Dec 2023 17:49:57 +0300 Subject: [PATCH] Fix: Do not bundle markdownit for clientside --- src/plugin/transform.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugin/transform.ts b/src/plugin/transform.ts index ccc9175..e814931 100644 --- a/src/plugin/transform.ts +++ b/src/plugin/transform.ts @@ -1,4 +1,4 @@ -import MarkdownIt from 'markdown-it'; +import type MarkdownIt from 'markdown-it'; import type { MarkdownItPluginCb, MarkdownItPluginOpts, @@ -126,7 +126,8 @@ export function transform(options: Partial = {}) { Object.assign(plugin, { collect(input: string, {destRoot}: InputOptions) { - const md = new MarkdownIt().use((md) => { + const MdIt = dynrequire('markdown-it'); + const md = new MdIt().use((md: MarkdownIt) => { registerTransforms(md, { classes, runtime,