Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exclude parameter for _api/* files #45

Open
magne4000 opened this issue Jan 29, 2024 · 5 comments
Open

Add exclude parameter for _api/* files #45

magne4000 opened this issue Jan 29, 2024 · 5 comments

Comments

@magne4000
Copy link
Owner

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

@reusables-official
Copy link

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
Copy link
Owner Author

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

@reusables-official
Copy link

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

@magne4000
Copy link
Owner Author

magne4000 commented Aug 12, 2024

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

@reusables-official
Copy link

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.

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

No branches or pull requests

1 participant