index imports may use the 'main' field from package.json
See original GitHub issueWe have a feature that re-writes import/export locations to explicitly give a path to a file (eg. foo -> foo/index) However, in the case of loading from node_modules, the actual path may not be index.js, for example
import * as ts from 'typescript'
should be re-written as
import * as ts from 'typescript/lib/typescript'
found by @chuckjaz
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to use the 'main' parameter in package.json?
You only need a main parameter in your package.json if the entry point to your package differs from index.js in its root folder....
Read more >"main" field in package.json is ignored when importing from ...
It seems like WebStorm just ignores the file specified in the "moduleB"s package.json. How can I make WebStorm use the cleaner import path ......
Read more >package.json - npm Docs
main. The main field is a module ID that is the primary entry point to your program. That is, if your package is...
Read more >Modules: Packages | Node.js v19.3.0 Documentation
In a package's package.json file, two fields can define entry points for a package: "main" and "exports" . Both fields apply to both...
Read more >Package exports - webpack
The exports field in the package.json of a package allows to declare which module should be used when using module requests like import...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates?
Obsolete.