From 5c4914deffc9750526a052848d122793d8cb7e5d Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Fri, 5 Mar 2021 21:39:55 -0800 Subject: [PATCH] fix(bazel): fix incorrect rollup plugin method signature (#41101) Update the resolveBazel method signature to align with the rollup plugin resolveId API: https://rollupjs.org/guide/en/#resolveid PR Close #41101 --- packages/bazel/src/ng_package/rollup.config.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/bazel/src/ng_package/rollup.config.js b/packages/bazel/src/ng_package/rollup.config.js index bab13a4162..efcafcb02f 100644 --- a/packages/bazel/src/ng_package/rollup.config.js +++ b/packages/bazel/src/ng_package/rollup.config.js @@ -49,15 +49,16 @@ function fileExists(filePath) { // This resolver mimics the TypeScript Path Mapping feature, which lets us resolve // modules based on a mapping of short names to paths. -function resolveBazel( - importee, importer, baseDir = process.cwd(), resolve = require.resolve, root = rootDir) { +function resolveBazel(importee, importer) { log_verbose(`resolving '${importee}' from ${importer}`); + const baseDir = process.cwd(); + function resolveInRootDir(importee) { - var candidate = path.join(baseDir, root, importee); + var candidate = path.join(baseDir, rootDir, importee); log_verbose(`try to resolve '${importee}' at '${candidate}'`); try { - var result = resolve(candidate); + var result = require.resolve(candidate); return result; } catch (e) { return undefined; @@ -80,7 +81,7 @@ function resolveBazel( // relative import if (importer) { let importerRootRelative = path.dirname(importer); - const relative = path.relative(path.join(baseDir, root), importerRootRelative); + const relative = path.relative(path.join(baseDir, rootDir), importerRootRelative); if (!relative.startsWith('.')) { importerRootRelative = relative; }