Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Fix module resolving when cwd === "babelrc" #45

Conversation

laurence-hudson-tessella

Not sure this will fix #43 in all contexts, but it does for me.

@laurence-hudson-tessella
Copy link
Author

If your content with this I'd appreciate an npm release with it in.

@tleunen
Copy link
Owner

tleunen commented Mar 22, 2017

Hi @laurence-hudson-tessella,

As explained in #43 (comment), we should resolve the string into the proper directory. I wonder how skipping the babelrc value can work, unless your babelrc file is at the root of the project, which will work indeed because the default cwd in the project root.

@laurence-hudson-tessella
Copy link
Author

Yes, that is correct. As this PR stands it only covers cases where the babelrc file is at the project root, but that's still an improvement over the current behavior, which never works when cwd === "babelrc".

@tleunen
Copy link
Owner

tleunen commented Apr 23, 2017

This should be resolved with the 4.0.0-beta.0 version, alongside the babel-plugin-module-resolver 3.0.0-beta.0.

Could you confirm please? Will reopen if not.

@tleunen tleunen closed this Apr 23, 2017
@laurence-hudson-tessella
Copy link
Author

Doesn't look promising:

$ npm outdated
Package                                   Current        Wanted  Latest  
babel-plugin-module-resolver         3.0.0-beta.0  3.0.0-beta.0   2.7.0  
eslint-import-resolver-babel-module  4.0.0-beta.0  4.0.0-beta.0   3.0.0  

with

{
  "plugins": [
    ["module-resolver", {
      "cwd": "babelrc",
      "alias": {
        "~shared": "./src/shared"
      }
    }]
  ]
}

results in a linting failure for every use of the alias.

Let me know if I missed something, or if there is more debugging info I can provide.

@tleunen tleunen self-assigned this Apr 24, 2017
@tleunen tleunen added the bug label Apr 24, 2017
@tleunen
Copy link
Owner

tleunen commented Apr 24, 2017

So you're right, there's still an issue with it. Reopening the ticket.

@tleunen tleunen reopened this Apr 24, 2017
@tleunen
Copy link
Owner

tleunen commented Apr 24, 2017

Will investigate further and see if there's a better fix because I'm not convinced we have to skip the value

@codecov
Copy link

codecov bot commented Apr 24, 2017

Codecov Report

Merging #45 into master will not change coverage.
The diff coverage is 100%.

Impacted Files Coverage Δ
src/index.js 100% <100%> (ø) ⬆️

@tleunen
Copy link
Owner

tleunen commented Apr 25, 2017

see #55

@tleunen tleunen closed this Apr 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

module resolving when cwd === "babelrc"
2 participants