Problem
examples:vite fails without pre-building workspace packages.
@react-simplikit/mobile's exports in package.json points to ./dist/index.js, which doesn't exist until the package is built.
[commonjs--resolver] Failed to resolve entry for package "@react-simplikit/mobile".
The package may have incorrect main/module/exports specified in its package.json.
Both Vite and Next.js resolve exports strictly and require the built output to exist.
Possible Solutions
- Root scripts with pre-build — e.g.
"example:vite": "yarn build && yarn workspace with-vite dev". Simple but rebuilds every time.
- Vite alias / Next.js transpilePackages to source — Configure alias or transpilation to point directly to
src/index.ts. Avoids build step but couples the example to source structure.
- Monorepo tooling (Turborepo, etc.) — Manages dependency graph so packages are built before dependents. Proper solution but may be overkill for current scale.
- Conditional exports for development — Add a
development condition in exports pointing to source, used only in dev.
Reproduction
# Clean state (no dist/)
rm -rf packages/mobile/dist packages/core/dist
# execute vite server
yarn example:vite
Problem
examples:vitefails without pre-building workspace packages.@react-simplikit/mobile'sexportsinpackage.jsonpoints to./dist/index.js, which doesn't exist until the package is built.Both Vite and Next.js resolve
exportsstrictly and require the built output to exist.Possible Solutions
"example:vite": "yarn build && yarn workspace with-vite dev". Simple but rebuilds every time.src/index.ts. Avoids build step but couples the example to source structure.developmentcondition inexportspointing to source, used only in dev.Reproduction