jsr icon indicating copy to clipboard operation
jsr copied to clipboard

jsr publish --dry-run suddenly failing (reading tsconfig.json???)

Open nzakas opened this issue 5 months ago • 1 comments

Within the last three days, running npx jsr@latest publish --dry-run has started failing on our repo: https://github.com/eslint/rewrite

Steps to reproduce

  1. git clone the repo
  2. npm install
  3. cd packages/config-array
  4. npm run test:jsr

Output

$ npm run test:jsr

> @eslint/[email protected] test:jsr     
> npx jsr@latest publish --dry-run

Checking for slow types in the public API...
error[excluded-module]: module in package's module graph was excluded from publishing 
 --> C:\Users\nzaka\projects\eslint\rewrite\packages\config-array\src\base-schema.js  
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module  

error[excluded-module]: module in package's module graph was excluded from publishing 
 --> C:\Users\nzaka\projects\eslint\rewrite\packages\config-array\src\config-array.js 
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module  

error[excluded-module]: module in package's module graph was excluded from publishing 
 --> C:\Users\nzaka\projects\eslint\rewrite\packages\config-array\src\files-and-ignores-schema.js
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module  

error[excluded-module]: module in package's module graph was excluded from publishing 
 --> C:\Users\nzaka\projects\eslint\rewrite\packages\config-array\src\index.js        
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module  

error[excluded-module]: module in package's module graph was excluded from publishing 
 --> C:\Users\nzaka\projects\eslint\rewrite\packages\config-array\src\types.ts        
  = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file or use 'publish.exclude' with a negative glob to unexclude from gitignore

  info: excluded modules referenced via a package export will error at runtime due to not existing in the package
  docs: https://jsr.io/go/excluded-module  

error: Found 5 problems

Discussion

This is very confusing because the files referenced in the output are explicitly not included in the jsr.json file. Further, these files are not ignored via .gitignore.

~~I can't figure out how jsr publish even finds src/index.js. It's not even referenced in package.json.~~

It seems to be that JSR has suddenly started reading tsconfig.json and assuming that files should be part of the published package? That's not a safe assumption to make in a world of bundlers. We have tsconfig.json set up primarily for editors before we bundle into a dist folder.

Also, how did this change happen outside of a new npm package version?

nzakas avatar Jul 03 '25 16:07 nzakas

As a followup: It appears there is no way to tell JSR that src/index.js is not part of the module to be published short of removing it from tsconfig.json, which will break our editor integration.

Please fix this behavior.

nzakas avatar Jul 03 '25 16:07 nzakas