From db0d65620c0cd0718e4c7968761953750529f35a Mon Sep 17 00:00:00 2001 From: Jianhua Cheng Date: Fri, 11 Jan 2019 14:58:47 +0800 Subject: [PATCH] fix(babel): transform alias with right current directory --- src/config/babel-config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config/babel-config.js b/src/config/babel-config.js index 2759bf0..3d4f41d 100644 --- a/src/config/babel-config.js +++ b/src/config/babel-config.js @@ -145,6 +145,11 @@ function getAliasPlugin() { require.resolve('babel-plugin-module-resolver'), { alias: mergedAlias, + // https://github.com/tleunen/babel-plugin-module-resolver/blob/master/DOCS.md#cwd + // in monorepo, build inside sub package is fine, but run all test files + // of all sub packages from root directory caused the incorrect target file + // use closet package.json as the current directory to transform path + cwd: 'packagejson', }, ] }