Usage with Vite web app #389
ekafyi
started this conversation in
Show and tell
Replies: 1 comment
-
Nice sharing, haven't payed with vite yet. But definitely on my list. I'm busy holidaying for 2 weeks... but I'm not against adding vite here too. Feel free if want to open a pr totally possible to merge it as an example Thx |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to share how I run a Vite app in this monorepo. (Yes this repo is called
nextjs-monorepo-example
😆 but just in case people want to make quick SPA web apps that don't require Next.js' features...)Steps:
yarn create vite
in theapps
directory (you may do it in any other directory, ofc).tsconfig.json
from existing sample app, eg. https://github.com/belgattitude/nextjs-monorepo-example/blob/main/apps/blog-app/tsconfig.json"baseUrl": "."
because eslint complains aboutvite.config.ts
being outside ofsrc
. I did not need to modify anything else, but depending on your other configs (the base config, eslint config, your vite project config) you may need to modify other stuff.paths
to local dependencies you want to import.package.json
— see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/apps/blog-app/package.json#L98-L99 for exampleyarn workspace my-vite-project add @your-org/ui-lib
vite.config.ts
a little, as discussed in Import module mapping / custom path resolution vitejs/vite#88. I use the solution by kfurles here: Import module mapping / custom path resolution vitejs/vite#88 (comment)Beta Was this translation helpful? Give feedback.
All reactions