Skip to content

fix: alias mobile source in vite example to avoid prebuild requirement#370

Merged
zztnrudzz13 merged 2 commits intotoss:mainfrom
byungsker:byungsker/issue-358-examples-prebuild
Apr 28, 2026
Merged

fix: alias mobile source in vite example to avoid prebuild requirement#370
zztnrudzz13 merged 2 commits intotoss:mainfrom
byungsker:byungsker/issue-358-examples-prebuild

Conversation

@byungsker
Copy link
Copy Markdown
Contributor

Overview

Fixes #358

When running yarn example:vite in a clean workspace (no prebuilt dist/), Vite fails to resolve @react-simplikit/mobile because the package's exports field points to dist/index.js, which doesn't exist yet.

This PR adds a resolve.alias to examples/with-vite/vite.config.ts that maps @react-simplikit/mobile directly to its TypeScript source entry (packages/mobile/src/index.ts), so the example dev server works without needing to build workspace packages first.

Note: The Next.js example (with-nextjs) was not affected — it starts successfully even without a prebuild step.

Checklist

  • Did you write the test code?
    • N/A — this is a dev tooling fix for the example app config, not a library change
  • Have you run yarn run fix to format and lint the code and docs?
  • Have you run yarn run test:coverage to make sure there is no uncovered line?
    • N/A — no library code changed
  • Did you write the JSDoc?
    • N/A — no new public API

@zztnrudzz13
Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

Would you consider including the build step when running yarn example:vite? I think this would help ensure the example runs in an environment that more closely mirrors the actual production setup.

@byungsker
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've updated the approach to run yarn build before starting the Vite dev server. This ensures the example runs against the built output, which mirrors production more closely.

I also reverted the vite.config.ts changes from the first commit — since the prebuild step ensures dist/index.js exists before Vite starts, the source alias is no longer needed and keeping both would be redundant.

@zztnrudzz13
Copy link
Copy Markdown
Collaborator

Thanks for the changes!

@zztnrudzz13 zztnrudzz13 merged commit 506b48a into toss:main Apr 28, 2026
11 of 12 checks passed
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.

examples project fails without pre-building workspace packages

2 participants