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();