REPRO-sveltekit-pnpm-ts-monorepo-error Svelte Themes

Repro Sveltekit Pnpm Ts Monorepo Error

Created as a tiny-repro to which I will link from a StackOverflow question I'll be posting.

SvelteKit PNPM Monorepo TS Errors Reproduction

Created as a tiny-repro to which I will link from a StackOverflow question I'll be posting.

Steps I followed to create this repro:

  1. mkdir example
  2. cd example
  3. pnpm init
  4. update package.json changing name to @example/root
  5. mkdir packages/app
  6. mkdir packages/pkg
  7. create pnpm-workspace.yaml
  8. cd packages/pkg
  9. pnpm init
  10. pnpm add @redis/client
  11. pnpm add -D typescript tsup
  12. update package.json changing name to @example/pkg, remove main key, add type=module, exports, and types. Add some useful scripts.
  13. create packages/pkg/index.ts (content visible in repo^)
  14. pnpm tsc --init
  15. pnpm run build (no errors, generated files seem reasonable.)
  16. cd ../app
  17. npm create svelte@latest . //suggested by https://kit.svelte.dev
    1. use current directory
    2. skeleton project
    3. use TS syntax
    4. no eslint, prettier, playwright, or vitest since they're not necessary for repro
  18. update package.json changing name to @example/app
  19. manually add pnpm workspace dependency to package.json: "@example/pkg": "workspace:^"
  20. pnpm install
  21. create packages/app/src/routes/+page.server.ts (content visible in repo^)
  22. cd packages/app && pnpm run dev
  23. navigate to http://localhost:5173/
  24. Note that the same error appears: Internal server error: exports is not defined
  25. git init
  26. echo "node_modules" > .gitignore
  27. git add .
  28. git commit

Top categories

Loading Svelte Themes