Use pnpm v11#20094
Conversation
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.
| "pnpm": { | ||
| "patchedDependencies": { | ||
| "@parcel/watcher@2.5.1": "patches/@parcel__watcher@2.5.1.patch", | ||
| "lightningcss@1.32.0": "patches/lightningcss@1.32.0.patch" | ||
| } | ||
| } |
There was a problem hiding this comment.
This is moved to the pnpm-workspace.yaml file
| '@parcel/watcher': true | ||
| bun: true | ||
| esbuild: true | ||
| sharp: false |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
This was hoisted to the pnpm-workspace.yaml file
| # TODO: Scope this just for the oxide-wasm32-wasi package | ||
| nodeLinker: hoisted | ||
| # packageConfigs: | ||
| # '@tailwindcss/oxide-wasm32-wasi': | ||
| # nodeLinker: hoisted |
There was a problem hiding this comment.
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.
| "prettier-plugin-organize-imports": "^4.3.0", | ||
| "tsup": "^8.5.1", | ||
| "turbo": "^2.9.6", | ||
| "turbo": "^2.9.14", |
There was a problem hiding this comment.
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
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/nodebut it requires CommonJS syntax. The.ctsfile is in ESM and is later converted to CommonJS during a build step. For that reason we changed theexportsfield to use thedist/files for CommonJS instead.This also cleans up the
pnpm-lock.yamlfile found in thewasm32-wasipackage. It also hoists thenodeLinkerto the rootpnpm-workspace.ymlfile as required by pnpm v11. That said, I noticed a weird bug withpnpm packthat it looks for a top-levelnodeLinkerbut 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.yamlfile. In our integration tests we often rely on thepnpm.overridesfield of thepackage.jsonfiles. So this PR also makes some changes there to make sure that we do move overrides to the yaml file.Test plan