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.
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 innode_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 amain
field. To be clear, this "sub-package" is not in the package'snode_modules
, it is just in a regular directory in the package,Under these circumstances, if the
extensions
array does not contain.js
, importing frompackage/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 insidenode_modules
.