If i have a project with rootproject/docs…i wanna somehow in a vercel.json file tell Vercel to serve or show the files inside root/docs instead of root/public/docs.
Also would be nice to update documentation where explaining whic files are shown are which not, and some example of structure project.
My project is based on html5 boilerplate and viete. So Vercel should automatically recognize the structure and make settins accordly.
import { defineConfig } from "vite";
export default defineConfig({
root: "./",
build: {
outDir: "dist",
},
// base: "https://ejgutierrez.github.io/Pacman2024Windows", // <= agrega la llave base
});
I dont have any vercel.json, i execute vercel in local to deploy
Ive been working all the weekend because the index.html was working, but not the docs…till in one discord channel of js developers told me that i had to use a new folder called public
As mentioned above i think you have to document this somewhere in the documentation, as i didnt found that information ( i still dont know how this community mate learned that all files should be in public directory).
Also if vite dont need to put all in a public folder, vercel should behave the same way. ( just my opinion)
When you run the vercel command locally, it uses default settings if no vercel.json is present. By adding the vercel.json file as described above, you’re explicitly telling Vercel how to handle your project.
The confusion about the ‘public’ directory is understandable. Here’s a clarification:
In Vite: The ‘public’ directory is for static assets that don’t need processing. These are copied to the root of your dist directory during build.
In Vercel: By default, Vercel serves from a ‘public’ directory if no other configuration is provided.
You don’t need to move your files to a ‘public’ directory. Your current structure is fine; we just need to tell Vercel where to look.
So i guess is related to my question, perhaps Vercel cant reach /js/sketch.js if not mentioned as module. Perhaps adding these directories to vercel.json would solve the problem ?
Also if i add /js would Vercel access all the folders inside recursevely ? i have for example /js/libraries/p5.min.js
@pawlean can you help me please ? With vite works fine, but in vercel i got an error:
Uncaught ReferenceError: p5 is not defined
Nn https://pacman2024windows.vercel.app/assets/index-Df26wdtU.js:1776
An https://pacman2024windows.vercel.app/assets/index-Df26wdtU.js:1
<anonymous> https://pacman2024windows.vercel.app/assets/index-Df26wdtU.js:1776
As vite in local i want to access my index.html showing some p5.js sketches, and then if i go to myproject/docs show de index of documentation.