-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Babel7] Does not resolve module for monorepo with babel-node #338
Comments
There could be a few issues here. First, it appears you run the command from the sub-package folder, so babel may see Then, try Finally, could you show the line you use to import the package in |
I've made a repo with the error I can reproduce:
Thanks a lot ;) |
Well if you do this:
It does pickup |
Note that this works:
|
I got the error : |
Add at the top:
It's a core module. |
…suecomment-449371804
Ooops, sorry. Done this, by got a new error:
Strange... |
That's because babel does not build anything outside the current require('@babel/register')({
// Find babel.config.js up the folder structure.
rootMode: 'upward',
// Since babel ignores all files outside the cwd, it does not compile sibling packages
// So rewrite the ignore list to only include node_modules
ignore: ['node_modules'],
}); |
It works ;) Thanks a lot ! |
Can this issue be closed? |
This is still an issue for me. When using monorepo |
I had the same problem as you. I solved it by creating a specific babel.config.js for each package and extending it to the root babel.config.js.
For each babel.config, I have this configuration:
|
@avallonazevedo fantastic thank you |
@avallonazevedo this does not work when you have babelrcRoots configured.
and this is the package config
And the error is classic |
Did you try to remove babelrcRoots? I believe that by placing the babel.config.js configuration in each package, babelrcRoots becomes unnecessary, correct? |
Hi there,
I have a monorepo designed like this:
In
packages/package-2
I have a script defined inpackage.json
like this:The babel config for module-resolver is :
The babel config is loaded, but can't resolve the module
'./packages/package-1'
:Thanks a lot !
EDIT: workaround for me : using yarn workspaces https://yarnpkg.com/lang/en/docs/workspaces/#toc-how-to-use-it
The text was updated successfully, but these errors were encountered: