Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(external): match root paths on unix-like and windows #891

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/esbuild/external.ts
Original file line number Diff line number Diff line change
@@ -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