From cfa6bba24bd215554a075baafa7dffc4c9f3dc18 Mon Sep 17 00:00:00 2001 From: ckohen Date: Thu, 15 Jun 2023 23:08:35 -0700 Subject: [PATCH] fix(external): match root paths on unix-like and windows (#891) --- src/esbuild/external.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/esbuild/external.ts b/src/esbuild/external.ts index 12188f34..868d0773 100644 --- a/src/esbuild/external.ts +++ b/src/esbuild/external.ts @@ -1,8 +1,8 @@ import { Plugin } from 'esbuild' import { tsconfigPathsToRegExp, match } from 'bundle-require' -// Must not start with "/" or "./" or "../" -const NON_NODE_MODULE_RE = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/ +// Must not start with "/" or "./" or "../" or "C:\" or be the exact strings ".." or "." +const NON_NODE_MODULE_RE = /^[A-Z]:[\\\/]|^\.{0,2}[\/]|^\.{1,2}$/ export const externalPlugin = ({ external, @@ -36,7 +36,7 @@ export const externalPlugin = ({ return { external: true } } // Exclude any other import that looks like a Node module - if (NON_NODE_MODULE_RE.test(args.path)) { + if (!NON_NODE_MODULE_RE.test(args.path)) { return { path: args.path, external: true,