From 19892f729058ba71f5160a03dad6d4081d50bd91 Mon Sep 17 00:00:00 2001 From: ckohen Date: Sat, 22 Apr 2023 17:35:37 -0700 Subject: [PATCH] fix(external): match root paths on unix-like and windows --- 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,