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

Make the babel instance configurable in babel-register #7263

Closed
Janpot opened this issue Jan 23, 2018 · 4 comments · Fixed by #7273
Closed

Make the babel instance configurable in babel-register #7263

Janpot opened this issue Jan 23, 2018 · 4 comments · Fixed by #7273
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@Janpot
Copy link
Contributor

Janpot commented Jan 23, 2018

The version of babel that is bundled with babel-register might not always be the same one as the one I want to register
like in this thread: a dependency (a babel plugin) wants to load modules of the dependant with the babel version of the dependant.

I propose to make it configurable like for instance

require('babel/register')({ babel: babelFromSomewhereElse });

I wouldn't mind making a PR for something like this if you agree.

@babel-bot
Copy link
Collaborator

Hey @Janpot! 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.

@Andarist
Copy link
Member

Andarist commented Jan 24, 2018

This would require some refactoring, as @babel/register is effectful module. To preserve old API and provide a new option it would have to be imported from other directory (i.e @babel/register/custom).

Our team tries to be focused at the moment on releasing v7, so I don't expect anyone starting to work on this right now. Community contribution would be invaluable to get this implemented sooner.

@Janpot
Copy link
Contributor Author

Janpot commented Jan 24, 2018

@Andarist I might not think of all intricacies involved, but to me it seems like it's sufficient to plumb a babel through the options and select it here instead of using the imported babel:

import babelCore from '@babel/core';

// ...

// inside compile()
const babel = opts.babel || babelCore

Wouldn't that be backwards compatible? I can make a PR for that if the babel team agrees.

@Andarist
Copy link
Member

Oh yeah, it might very well be that easy. Was looking quickly at the source code and thought that register is more tied to to babel's instance.

I might not think of all intricacies involved,

Me neither 😅 You can start a PR to get ball rolling faster.

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

Successfully merging a pull request may close this issue.

3 participants