magne4000 / vite-plugin-vercel

Vercel adapter for vite
https://test-vite-vercel-plugin.vercel.app
98 stars 14 forks source link

Add `exclude` parameter for `_api/*` files #45

Open magne4000 opened 9 months ago

magne4000 commented 9 months ago

With sensitive default value (like ignoring .test and .spec files)

reusables-official commented 3 months ago

I currently am trying to build my application with some png files in a "hidden" folder in /api, at /api/_images/*.png for example, but this yields a build error saying no loader for png files is provided.

Is this a similar issue? Why is Vite trying to bundle these png files?

magne4000 commented 3 months ago

Could you create a small reproduction repo so that I can see what you are trying to do?

reusables-official commented 3 months ago

@magne4000 Here you are: https://github.com/reusables-official/vite-vercel-debug, notes in README

magne4000 commented 2 months ago

I would recommend moving the .png files outside of /api folder. Vite defaults to public folder for this kind of usage.

reusables-official commented 2 months ago

I would recommend moving the .png files outside of /api folder. Vite defaults to public folder for kind of usage.

OK thank you I can try that. I believe my confusion is coming from a misunderstanding of Vite as a client app bundler and how it relates to Vercel's API folder/serverless functions. I wasn't aware that I could include files from the "client code" side of things in the Vercel function but given it's all just a file system I suppose it makes sense. Perhaps I'm still in the client/server paradigm which is blurred in this context.