fix: pack includes dist + ads-react build order#41
Merged
Conversation
… fix ads-react build order Without a `files` field and no `.npmignore`, pnpm pack honors `.gitignore` which excludes `dist/` — the tarball sent to CodeArtifact was missing the built output. For ads-react: DK runs nodeCommands from contextPath (packages/react), so ads-core dist doesn't exist yet when tsup tries to generate .d.ts. A `prebuild` lifecycle script builds ads-core first. - Add `files: ["dist", "src", ...]` to both packages so pnpm pack includes dist - Add `prebuild` to ads-react that builds ads-core before tsup runs - Move @swc/core from dependencies to devDependencies (it's a build tool, not runtime) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Root causes
Bug 1 — ads-core
pack-and-publish-cafaileddist/is in.gitignore. Without afilesfield or.npmignore,pnpm packhonors.gitignoreand excludesdist/. The tarball sent to CodeArtifact had no built output.Fix: add
files: ["dist", "src", "README.md", "CHANGELOG.md"]to both packages.Bug 2 — ads-react
node-commandfailed in 13sDK runs
nodeCommandsfromcontextPath(packages/react). When tsup runs withdts: true, TypeScript tries to resolve@vtex/ads-coretypes frompackages/core/dist/esm/index.d.ts— butdist/doesn't exist because ads-core hasn't been built yet in this isolated context.Fix: add
"prebuild": "pnpm --filter @vtex/ads-core run build"to ads-react scripts. npm/pnpm lifecycle hooks runprebuildautomatically beforebuild, so ads-core is built first.Bonus fix
@swc/corewas independenciesinstead ofdevDependencies. It's a TypeScript compiler used only at build time — it was being installed unnecessarily by consumers of@vtex/ads-core.Changes
packages/core/package.json: addfiles, move@swc/coreto devDepspackages/react/package.json: addfiles, addprebuildscriptTest plan
v0.5.2(delete and re-create, or usev0.5.3if preferred)node-commandsteps passpack-and-publish-casteps pass@vtex/ads-core@0.5.2and@vtex/ads-react@0.5.2published to npm🤖 Generated with Claude Code