Skip to content

Commit 2cac571

Browse files
wintercounterkentcdodds
authored andcommitted
feat(resolve): add fallback path to resolve modules relatively (#138)
* feat(resolve): add fallback path to be able to resolve modules relatively to `babel-plugin-macros` * Update index.js Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
1 parent b674123 commit 2cac571

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ function createMacro(macro, options = {}) {
6363
}
6464

6565
function nodeResolvePath(source, basedir) {
66-
return resolve.sync(source, {basedir})
66+
return resolve.sync(source, {
67+
basedir,
68+
// This is here to support the package being globally installed
69+
// read more: https://github.com/kentcdodds/babel-plugin-macros/pull/138
70+
paths: [p.resolve(__dirname, '../../')]
71+
})
6772
}
6873

6974
function macrosPlugin(

0 commit comments

Comments
 (0)