Skip to content

Use pnpm v11#20094

Draft
RobinMalfait wants to merge 14 commits into
mainfrom
feat/use-pnpm-11
Draft

Use pnpm v11#20094
RobinMalfait wants to merge 14 commits into
mainfrom
feat/use-pnpm-11

Conversation

@RobinMalfait
Copy link
Copy Markdown
Member

@RobinMalfait RobinMalfait commented May 21, 2026

This PR upgrades the repo to use pnpm v11

This also includes some cleanup to make sure all builds work. For example the Next.js playground uses @tailwindcss/node but it requires CommonJS syntax. The .cts file is in ESM and is later converted to CommonJS during a build step. For that reason we changed the exports field to use the dist/ files for CommonJS instead.

This also cleans up the pnpm-lock.yaml file found in the wasm32-wasi package. It also hoists the nodeLinker to the root pnpm-workspace.yml file as required by pnpm v11. That said, I noticed a weird bug with pnpm pack that it looks for a top-level nodeLinker but not for a specific package. For that we use the nodeLinker flag during our pack command.

Pnpm 11 (maybe even 10) moves a lot of information to the pnpm-workspace.yaml file. In our integration tests we often rely on the pnpm.overrides field of the package.json files. So this PR also makes some changes there to make sure that we do move overrides to the yaml file.

Test plan

  • All tests should pass on all platforms [ci-all]

The issue is sthat for `require` in exports, the file has to be in
CommonJS syntax. But that only happens once we compile.

We can try to modify the the .cts file directly to get it into a more
CommonJS-style file. But I think it's safer to just rely on the build files.

This is only necessary for our Next.js playground where we require CommonJS.

Other spots that use `@tailwindcss/node` during tests will still use the
src file in TypeScript / ESM format.
Comment thread package.json
Comment on lines -64 to -69
"pnpm": {
"patchedDependencies": {
"@parcel/watcher@2.5.1": "patches/@parcel__watcher@2.5.1.patch",
"lightningcss@1.32.0": "patches/lightningcss@1.32.0.patch"
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved to the pnpm-workspace.yaml file

Comment thread pnpm-workspace.yaml
'@parcel/watcher': true
bun: true
esbuild: true
sharp: false
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used in the Next.js playground where we don't work with images so no need to allow the build for this.

@@ -1 +0,0 @@
node-linker=hoisted
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was hoisted to the pnpm-workspace.yaml file

Comment thread pnpm-workspace.yaml
Comment on lines +35 to +39
# TODO: Scope this just for the oxide-wasm32-wasi package
nodeLinker: hoisted
# packageConfigs:
# '@tailwindcss/oxide-wasm32-wasi':
# nodeLinker: hoisted
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we scope nodeLinker just for the @tailwindcss/oxide-wasm32-wasi package, but that causes issues during pnpm install

The initial setup was done using pnpx codemod run pnpm-v10-to-v11, but turns out that's invalid.

Comment thread package.json
"prettier-plugin-organize-imports": "^4.3.0",
"tsup": "^8.5.1",
"turbo": "^2.9.6",
"turbo": "^2.9.14",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary for pnpm v11 compatibility. See: https://github.com/vercel/turborepo/releases/tag/v2.9.7

We only needed to bump 1 patch version, but using the latest version to get other fixes.

Because of the `nodeLinker: hoisted`, resolutions of dependencies start
from the root where `tailwindcss` couldn't be found.

I don't like this, I don't like the top-level `nodeLinker` setup. But
going to see if we can get further with this setup in CI.
We do need the workspace for the overrides to work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant