Reputation: 63
i have a reactjs website using vitejs when i compile it using npm run build
it generates the compiled site inside dist folder, when i publish the content to this folder i encounter a
Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.
and serval
GET https://brijrajparmar27.github.io/assets/index.d12487b2.js net::ERR_ABORTED 404
here what i find odd is that if you check the url in above error its trying to find the .js file inside brijrajparmar27.github.io/assets/
shouldn't it be inside https://brijrajparmar27.github.io/[Repo-Name]/assets
?
it still works on my localhost though somehow.
after looking at this i added the [Repo-name]/
manually at the beginning of link tags of compiled index.html file in dist folder, on hosting that i got
GET https://brijrajparmar27.github.io/Atmosphere/Atmosphere/assets/vendor.95b2f1d7.js net::ERR_ABORTED 404
repo name is listed twice.
Upvotes: 4
Views: 4328
Reputation: 101
It seems that vite build
defaults base to single "/" https://vitejs.dev/config/#base
I've fixed issue with incorrect request URL by changing build script in package.json to:
"build": "vite build --base=./"
Upvotes: 10