Skip to content
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

In the @babel/core, config a String plugins, can not resolve module #9174

Closed
qingxiao opened this issue Dec 13, 2018 · 5 comments
Closed

In the @babel/core, config a String plugins, can not resolve module #9174

qingxiao opened this issue Dec 13, 2018 · 5 comments
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@qingxiao
Copy link

Feature Request

return resolve.sync(standardizedName, { basedir: dirname });

this code use resolve.sync to load a plugin, when i config a plugin like that

{
    presets: ['@babel/preset-env']
}

Because the default here is { basedir: dirname }, so module will find by

0:"/Users/username/projectDir/node_modules"
1:"/Users/username/node_modules"
2:"/Users/node_modules"
3:"/node_modules"

resoleve module support resolve. sync (name, {paths: custormPaths}),
it can be added in thebable-loaderconfiguration? like webpack resolve loader config

...
    // in resolve/lib/node-modules-paths.js nodeModulesPaths 
    return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
...

so we can use custorm path to find a module, Thanks!

@babel-bot
Copy link
Collaborator

Hey @qingxiao! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

You could use require directly in your Babel config.

@loganfsmyth
Copy link
Member

loganfsmyth commented Dec 16, 2018

Babels config system is not configurable. I'd use a jobJS config to return an absolute path if you need custom resolve logic.

@qingxiao
Copy link
Author

Babels config system is not configurable. I'd use a job config to return an absolute path if you need custom resolve logic.

Ok, got it. thank you

@loganfsmyth
Copy link
Member

Oh autocomplete screwed that up FYI, I meant "a js config".

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants