Skip to content

Commit d248a55

Browse files
authored
Fix for broken win push (#553)
Fixes #550 , our custom multi-asset plugin couldn't handle windows paths that start with C:\ and similar. Switched to FS agnostic code. The errors this caused were somewhat confusing because this only causes esbuild to fail later in its process with the message described in #550 .
1 parent 8339097 commit d248a55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/push/plugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ export type PluginData = {
4949
export type PluginCallback = (data: PluginData) => void;
5050

5151
export function MultiAssetPlugin(callback: PluginCallback): esbuild.Plugin {
52+
// Check that the path isn't in an external package by making sure it's at a standard
53+
// local filesystem location
5254
const isBare = (str: string) => {
53-
if (str.startsWith('/') || str.startsWith('./') || str.startsWith('../')) {
55+
// Note that we use `isAbsolute` to handle UNC/windows style paths like C:\path\to\thing
56+
// This is not necessary for relative directories since `.\file` is not supported as an import
57+
// nor is `~/path/to/file`.
58+
if (path.isAbsolute(str) || str.startsWith('./') || str.startsWith('../')) {
5459
return true;
5560
}
5661
return false;

0 commit comments

Comments
 (0)