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

Unexpected use of file extensions #22

Open
aryzing opened this issue Nov 4, 2021 · 0 comments
Open

Unexpected use of file extensions #22

aryzing opened this issue Nov 4, 2021 · 0 comments

Comments

@aryzing
Copy link

aryzing commented Nov 4, 2021

I'm working with a project written entirely in TS. This project imports code from node_modules, which for the most part is in plain JS. Despite everything in node_modules being in JS, the plugin works as expected when defining the extensions array as [.ts, .tsx].

However -- There is one package I'm importing which contains another "sub-package": it has a folder with a package.json with a main field. To be clear, this "sub-package" is not in the package's node_modules, it is just in a regular directory in the package,

# contents of package inside root node_modules
node_modules/ # the package's own packages
package.json
index.js
some-folder/
  package.json # with "main": "lib"
  lib/
    index.js

Under these circumstances, if the extensions array does not contain .js, importing from package/some-folder with throw an error. Is this a bug? Was under the impression that the extensions array should not have an effect when the fully resolved path lives inside node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant