You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Behavior
When using @babel/register, using programatic configuration, with @babel/preset-env and using the only option, a execution the following error Error: Cannot find module '@babel/preset-env' is thrown.
## Clone the repo and checkout branch with reproduction code
$ git clone https://github.com/semantic-release/travis-deploy-once
$ git checkout babel-issue-#8777
## Install the package globally from the file system
$ yarn global add file:$PWD## Change working directory to anywhere other than the repo
$ cd~## Run the globally installed binary
$ travis-deploy-once
The error Error: Cannot find module '@babel/preset-env' will be thrown because try to load the plugins/preset from the current working directory (~ in this example) rather than from where the code run.
If the only option is removed from the config, then the travis-deploy-once works as expected on Node 10 (it should return "Not running on Travis"). However it fails on Node 6 with a syntax exception as the sources are not compiled.
Expected behavior/code @babel/register should load babel plugins and preset from where it runs and not from the current working directory.
Hey @pvdlg! 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.
That really look like a workaround though....It basically resolve the path of the plugins/presets with require.resolve because it seems @babel/register doesn't do that properly.
I still think @babel/register should be able to resolve @babel/preset-env by itself, by resolving from the file in which it's defined, rather than the current working directory.
Bug Report
Current Behavior
When using
@babel/register
, using programatic configuration, with@babel/preset-env
and using theonly
option, a execution the following errorError: Cannot find module '@babel/preset-env'
is thrown.Input Code
See repo https://github.com/semantic-release/travis-deploy-once/tree/babel-issue-%238777:
@babel/preset-env
inpackage.json
@babel/register
configurationTo reproduce:
The error
Error: Cannot find module '@babel/preset-env'
will be thrown because try to load the plugins/preset from the current working directory (~
in this example) rather than from where the code run.If the
only
option is removed from the config, then thetravis-deploy-once
works as expected on Node 10 (it should return "Not running on Travis"). However it fails on Node 6 with a syntax exception as the sources are not compiled.Expected behavior/code
@babel/register
should load babel plugins and preset from where it runs and not from the current working directory.Babel Configuration (.babelrc, package.json, cli command)
Environment
The text was updated successfully, but these errors were encountered: