From c4f1d90c7b7db3fc1bb85f8133f4f19623a4a1b4 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 26 Jul 2022 15:03:19 +1000 Subject: [PATCH] fix: no need to append `.js` to import for external packages --- build-scripts/fix-imports.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-scripts/fix-imports.js b/build-scripts/fix-imports.js index 8eaee14d6c..e7886a921c 100644 --- a/build-scripts/fix-imports.js +++ b/build-scripts/fix-imports.js @@ -3,7 +3,7 @@ import fs from "fs"; const START_PATH = path.join(process.cwd(), "dist/esm"); const IMPORT_REGEXP = - /^((import|export) [^';]* from "(@[^";]+\/)?([^@";]*\/[^";]*)[^";]*)"/g; + /^((import|export) [^';]* from "(\.[^@";]*\/[^";]*)[^";]*)"/g; const JUST_ADD_AN_EXTENSION = '$1.js"'; const ADD_INDEX_FILE = '$1/index.js"'; const JS_EXT = ".js"; @@ -36,7 +36,7 @@ function fixImportsAtFile(filePath) { } const [_, importPath] = l.split(`"`); - let exists = true; + let exists; let fullPath; if (importPath.startsWith(".")) { fullPath = path.join(filePath, "..", importPath);