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.

package.main incorrectly set to cjs/index.js

See original GitHub issue

Running packemon build sets the main field on package.json to ./cjs/index.cjs but ./cjs/index.cjs does not exist. I think it should be set to the value under exports["."].node value which in this case points to an actual file: ./cjs/node.cjs.

It also adds "src/**/*.{ts,tsx,json}" to the files field. Is there a reason for this? Is there a way to make it not touch package.json

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
milesjcommented, May 18, 2021

Ok, now fixed!

1reaction
milesjcommented, Mar 28, 2021

@kaleidawave Wait, so this input:

{
    "inputs": {
      "index": "src/node.ts"
    },
    "format": "cjs",
    "platform": "node"
  },

Is writing to cjs/node.cjs and not cjs/index.cjs? That seems like a bug.

Also, src is included in files because they are required for source maps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot find module" when main file not index.js with ... - GitHub
mjs files and I want to use extension-less import statements. I prefer to use Lib.js instead of index.js to distinguish in my IDE...
Read more >
How to choose 'module' instead of 'main' file in package.json
I have some simple helper JS functions like this and this, and I would want them to be usable to the widest audience....
Read more >
Hybrid npm packages (ESM and CommonJS) - 2ality
In this blog post, we look at npm packages that contain both ES modules and CommonJS modules.
Read more >
Build a JavaScript library with multiple entry points using Vite3
In this post, I'll show how you can create a lib with multiple entry points (sub-modules) using Vite 3.
Read more >
Firebase JavaScript SDK Release Notes - Google
Fixed some incorrect package.json paths to entry points in Authentication and Cloud Firestore. Realtime Database. Removed @firebase ...
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