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

babel.config.js is ignored when working in symlinked directory #8782

Open
Jasyer opened this Issue Sep 28, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@Jasyer

Jasyer commented Sep 28, 2018

Bug Report

Current Behavior
If the working path contains symlimked directory the configuration file isn't handled.

Input Code
I made dummy test.js with the content:

export default {
    a: 1,
    b: 2
}

and babel.config.js with the content:

module.exports = {
    presets: [
        '@babel/preset-env'
    ]
};

and package.json with content:

{
  "dependencies": {
    "@babel/core": "^7.1.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/register": "^7.0.0"
  }
}

I placed them in test folder and make the directory junction test-link near the test folder.
The directory tree is:

|- test
|  |- babel.config.js
|  |- package.json
|  `- test.js
`- test-link -> test

After installing dependencies with yarn install command I tried to run node -r @babel/register test.js in both test and test-link directories.

And it worked in test directory and failed in test-link with error:

C:\temp\test-link>node -r @babel/register test.js
C:\temp\test\test.js:1
(function (exports, require, module, __filename, __dirname) { export default {
                                                              ^^^^^^

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Module._compile (C:\temp\test\node_modules\pirates\lib\index.js:83:24)
    at Module._extensions..js (module.js:664:10)
    at Object.newLoader [as .js] (C:\temp\test\node_modules\pirates\lib\index.js:88:7)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)

Environment

  • Babel v7.1.0
  • Node v8.12, yarn v1.10.0
  • OS: Windows Server 2016 Standard
  • How you are using Babel: register
@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Sep 28, 2018

Collaborator

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

Collaborator

babel-bot commented Sep 28, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment