No "exports" main defined in… @rollup/plugin-alias/package.json
Describe the bug
When running pn run link-watch I get the following message:
No "exports" main defined in /Users/wvgg/projects/my-sanity-plugin/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@rollup/plugin-alias/package.json
Similar error when installing via npm:
[error] No "exports" main defined in /Users/wvgg/projects/my-sanity-plugin/node_modules/@rollup/plugin-alias/package.json
To Reproduce
Steps to reproduce the behavior:
This is happening consistently with new installs, just following the normal directions.
npx @sanity/plugin-kit@latest init sanity-plugin-testing-it-outcd sanity-plugin-testing-it-outnpm run link-watch
Expected behavior
Should "just work"
Which versions of Sanity are you using?
@sanity/incompatible-plugin 1.0.5 (up to date) @sanity/pkg-utils 9.0.6 (up to date) @sanity/plugin-kit 4.0.20 (up to date) @sanity/ui 3.1.11 (up to date) sanity 4.14.2 (latest: 4.15.0)
What operating system are you using?
MacOS 26.2
Which versions of Node.js / npm are you running?
10.9.2 v22.17.0 (pnpm 10.13.1)
note: when switching to Node v20, the error message changes to:
[error] require() of ES Module /Users/wvgg/projects/sanity-next-redirects/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@sanity/pkg-utils/dist/index.js from /Users/wvgg/Sites/_open_source_projects/sanity-next-redirects/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@sanity/plugin-kit/dist/_chunks-cjs/link-watch.js not supported.
Instead change the require of index.js in /Users/wvgg/projects/sanity-next-redirects/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@sanity/plugin-kit/dist/_chunks-cjs/link-watch.js to a dynamic import() which is available in all CommonJS modules.
I have managed to get things working with two steps:
- downgrade to
"@sanity/pkg-utils": "8.1.12" - add
"yalc": "1.0.0-pre.53"as a dev dependency.
As it stands, I think this repo is a little broken.