Skip to content

Commit cfa6bba

Browse files
authoredJun 16, 2023
fix(external): match root paths on unix-like and windows (#891)
1 parent b10a1ad commit cfa6bba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/esbuild/external.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Plugin } from 'esbuild'
22
import { tsconfigPathsToRegExp, match } from 'bundle-require'
33

4-
// Must not start with "/" or "./" or "../"
5-
const NON_NODE_MODULE_RE = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/
4+
// Must not start with "/" or "./" or "../" or "C:\" or be the exact strings ".." or "."
5+
const NON_NODE_MODULE_RE = /^[A-Z]:[\\\/]|^\.{0,2}[\/]|^\.{1,2}$/
66

77
export const externalPlugin = ({
88
external,
@@ -36,7 +36,7 @@ export const externalPlugin = ({
3636
return { external: true }
3737
}
3838
// Exclude any other import that looks like a Node module
39-
if (NON_NODE_MODULE_RE.test(args.path)) {
39+
if (!NON_NODE_MODULE_RE.test(args.path)) {
4040
return {
4141
path: args.path,
4242
external: true,

0 commit comments

Comments
 (0)
Please sign in to comment.