From fa98792c30f92fc49105adb4e378fd91c36b0233 Mon Sep 17 00:00:00 2001 From: mooooooi Date: Fri, 15 Oct 2021 01:35:04 +0800 Subject: [PATCH 1/4] fix: transform cannot find module --- cli/util/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/util/options.js b/cli/util/options.js index ee23563de9..b88a48353a 100644 --- a/cli/util/options.js +++ b/cli/util/options.js @@ -247,7 +247,7 @@ function resolvePath(p, baseDir, useNodeResolution = false) { if (useNodeResolution && !p.startsWith(".")) { return dynrequire.resolve(p, { paths: [ baseDir ] }); } - return path.join(baseDir, p); + return path.resolve(baseDir, p); } exports.resolvePath = resolvePath; From b169622048658feb7a4a4f69f110f9d1c17a9b20 Mon Sep 17 00:00:00 2001 From: mooooooi Date: Fri, 15 Oct 2021 01:56:34 +0800 Subject: [PATCH 2/4] Update NOTICE --- NOTICE | 1 + 1 file changed, 1 insertion(+) diff --git a/NOTICE b/NOTICE index 6226bc34ab..3160d03559 100644 --- a/NOTICE +++ b/NOTICE @@ -43,6 +43,7 @@ under the licensing terms detailed in LICENSE: * Joe Pea * Felipe Gasper * Congcong Cai <77575210+HerrCai0907@users.noreply.github.com> +* mooooooi Portions of this software are derived from third-party works licensed under the following terms: From 41bf824d9a2da9e9692009d5f71fd722e135324b Mon Sep 17 00:00:00 2001 From: mooooooi Date: Sat, 23 Oct 2021 16:43:02 +0800 Subject: [PATCH 3/4] fix: support to browser sdk --- cli/util/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/util/options.js b/cli/util/options.js index b88a48353a..375f7754e2 100644 --- a/cli/util/options.js +++ b/cli/util/options.js @@ -243,7 +243,7 @@ const dynrequire = typeof __webpack_require__ === "function" /** Resolves a single possibly relative path. Keeps absolute paths, otherwise prepends baseDir. */ function resolvePath(p, baseDir, useNodeResolution = false) { - if (path.isAbsolute(p)) return p; + if (path.isAbsolute(p) || (baseDir == "." && p.startsWith("./"))) return p; if (useNodeResolution && !p.startsWith(".")) { return dynrequire.resolve(p, { paths: [ baseDir ] }); } From 6e6e9e4cc04320c129b2579884ce6eec7dd44d90 Mon Sep 17 00:00:00 2001 From: mooooooi Date: Sun, 24 Oct 2021 15:23:09 +0800 Subject: [PATCH 4/4] feat: add normalizePath function --- cli/util/options.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cli/util/options.js b/cli/util/options.js index 375f7754e2..c4159fec27 100644 --- a/cli/util/options.js +++ b/cli/util/options.js @@ -237,17 +237,27 @@ function merge(config, currentOptions, parentOptions, parentBaseDir) { exports.merge = merge; +function normalizePath(p) { + const parsed = path.parse(p); + if (!parsed.root) { + parsed.root = "./"; + } + return path.format(parsed); +} + +exports.normalizePath = normalizePath; + const dynrequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; /** Resolves a single possibly relative path. Keeps absolute paths, otherwise prepends baseDir. */ function resolvePath(p, baseDir, useNodeResolution = false) { - if (path.isAbsolute(p) || (baseDir == "." && p.startsWith("./"))) return p; + if (path.isAbsolute(p)) return p; if (useNodeResolution && !p.startsWith(".")) { return dynrequire.resolve(p, { paths: [ baseDir ] }); } - return path.resolve(baseDir, p); + return normalizePath(path.join(baseDir, p)); } exports.resolvePath = resolvePath;