From 508fec9532207fffd0470f876ebb6c70b521767a Mon Sep 17 00:00:00 2001 From: Oliver Shi Date: Thu, 31 Aug 2023 12:04:34 -0400 Subject: [PATCH] Remove duplicate slash in browser dynamic imports on mac/ubuntu (#361) TEST=manual J=None tested that dynamic imports work on both windows and mac --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/studio/src/utils/dynamicImportFromBrowser.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/studio/src/utils/dynamicImportFromBrowser.ts b/packages/studio/src/utils/dynamicImportFromBrowser.ts index 3494f3bdc..fbcad436f 100644 --- a/packages/studio/src/utils/dynamicImportFromBrowser.ts +++ b/packages/studio/src/utils/dynamicImportFromBrowser.ts @@ -1,3 +1,5 @@ +import path from "path-browserify"; + /* eslint-disable @typescript-eslint/no-explicit-any */ /** * In order to support dynamic imports from the browser on Windows, @@ -8,5 +10,6 @@ export default function dynamicImportFromBrowser( absFilepath: string ): Promise { - return import(/* @vite-ignore */ "/@fs/" + absFilepath); + const importPath = path.join("/@fs", absFilepath); + return import(/* @vite-ignore */ importPath); }