Skip to content

Commit

Permalink
Fix for broken win push (#553)
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
andrewvc authored Jul 19, 2022
1 parent 8339097 commit d248a55
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/push/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ export type PluginData = {
export type PluginCallback = (data: PluginData) => void;

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

0 comments on commit d248a55

Please sign in to comment.