From 6f8045208ec71da567a7a3358295d5e5f8a6a740 Mon Sep 17 00:00:00 2001 From: SettingDust Date: Thu, 1 Dec 2022 12:16:24 +0800 Subject: [PATCH] chore(build): measure of evanw/esbuild#2706 --- build.ts | 2 +- src/utilities.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.ts b/build.ts index e7a0208..35bba7a 100644 --- a/build.ts +++ b/build.ts @@ -9,7 +9,7 @@ import { nodeExternalsPlugin } from 'esbuild-node-externals'; target: 'es2017', logLevel: 'info', color: true, - minify: true, + minifySyntax: true, sourcemap: true, legalComments: 'external' } diff --git a/src/utilities.ts b/src/utilities.ts index fcee937..c6710e7 100644 --- a/src/utilities.ts +++ b/src/utilities.ts @@ -179,10 +179,11 @@ export function parseHTML(html: string, options: NodeHtmlMarkdownOptions): Eleme el = tryParseWithNativeDom(html); } catch (e) { - if (__IS_BROWSER__) throw e; - nodeHtmlParse = getNodeHtmlParser(); - if (nodeHtmlParse) console.warn('Native DOM parser encountered an error during parse', e); - else throw e; + if (!__IS_BROWSER__) { + nodeHtmlParse = getNodeHtmlParser(); + if (nodeHtmlParse) console.warn('Native DOM parser encountered an error during parse', e); + else throw e; + } else throw e; } } else nodeHtmlParse = getNodeHtmlParser();