question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

index imports may use the 'main' field from package.json

See original GitHub issue

We 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:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ceborcommented, Jul 13, 2017

Any updates?

0reactions
evmarcommented, Aug 20, 2019

Obsolete.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found