Skip to content

Commit

Permalink
fix(external): match root paths on unix-like and windows (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckohen committed Jun 16, 2023
1 parent b10a1ad commit cfa6bba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cfa6bba

Please sign in to comment.