Fix npm build excluding esm/src/ and script/src/ directories#9
Conversation
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
|
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Removed verification script and investigated deeper. Root cause: DNT 0.37.0 generates DNT behavior: Identical in both 1.0.1 and 1.0.2 - same DNT version (0.37.0), same build script, same missing sourceMap config. Both should generate Solution: Replace Changes in commit df7e0cf. |
|
@copilot add tests .d.ts to gitignore |
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
|
@copilot my bad... To .npmignore, not gitignore |
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
DNT 0.37.0 generates
.npmignorewithsrc/pattern by default when source maps are not configured. This pattern inadvertently excludesesm/src/andscript/src/containing transpiled code, causing v1.0.2 module resolution failures.Root Cause Analysis
DNT automatically adds
src/to.npmignorewhensourceMapoptions are not specified in the build configuration. This is documented in DNT's source code (lib/npm_ignore.ts):The same DNT version (0.37.0) and identical build scripts were used for both 1.0.1 and 1.0.2, meaning this pattern has always been generated. The issue affects 1.0.2 because the generic
src/pattern matches:esm/src/(transpiled ESM JavaScript - required for package)script/src/(transpiled CommonJS JavaScript - required for package)npm/src/(TypeScript sources - correctly excluded)Changes
Build Script Fix
.npmignoreto replacesrc/with/src/after DNT build/restricts pattern to root directory only, preserving transpiled code in subdirectories*.test.d.tsandtests/**/*.d.tspatterns to.npmignoreto exclude generated test declaration files from npm packageResult
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.