Open smeijer opened 2 months ago
Files that are excluded by an exclude: [glob], and are not written to ./dist, are still written to package.json#exports. I've created a small repo here: https://stackblitz.com/edit/tshy-exclude-exports?file=package.json&terminal=dev
exclude: [glob]
./dist
package.json#exports
Assuming the following package.json config:
"tshy": { "exclude": [ "src/**.test.ts" ], "exports": [ "src/*.ts" ] },
And the following source files:
/src/index.ts /src/another.ts /src/another.test.ts
The following dist files are generated: (as expected)
/dist/commonjs/another.d.ts /dist/commonjs/another.d.ts.map /dist/commonjs/another.js /dist/commonjs/another.js.map /dist/commonjs/index.d.ts /dist/commonjs/index.d.ts.map /dist/commonjs/index.js /dist/commonjs/index.js.map /dist/commonjs/package.json /dist/esm/another.d.ts /dist/esm/another.d.ts.map /dist/esm/another.js /dist/esm/another.js.map /dist/esm/index.d.ts /dist/esm/index.d.ts.map /dist/esm/index.js /dist/esm/index.js.map /dist/esm/package.json
Generated package.json#exports (unexpected)
"exports": { "./another.test": { <<< this shouldn't be here "import": { "types": "./dist/esm/another.test.d.ts", "default": "./dist/esm/another.test.js" }, "require": { "types": "./dist/commonjs/another.test.d.ts", "default": "./dist/commonjs/another.test.js" } }, "./another": { "import": { "types": "./dist/esm/another.d.ts", "default": "./dist/esm/another.js" }, "require": { "types": "./dist/commonjs/another.d.ts", "default": "./dist/commonjs/another.js" } }, ".": { "import": { "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, "require": { "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } }, "./package.json": "./package.json" },
Ah, yes, when it expands the glob exports, it's not using the excluded as an ignore patter, as it should be.
Files that are excluded by an
exclude: [glob]
, and are not written to./dist
, are still written topackage.json#exports
. I've created a small repo here: https://stackblitz.com/edit/tshy-exclude-exports?file=package.json&terminal=devAssuming the following package.json config:
And the following source files:
The following dist files are generated: (as expected)
Generated
package.json#exports
(unexpected)