Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploying problem with multiple html files. Parcel

when I deploy a website( with multiple entry points, many HTML files ) and the host uses the build command: parcel build index.html aboutme.html. the website deployed give me a 404 error. But if I write in the URL /aboutme.html or /index.html it goes... it's like a routeing problem.

HTTP://localhost:1234 => 404 error,
HTTP://localhost:1234/aboutme.html => it goes.

with 1 entry point, it goes all right, but I want multiple HTML files.

I've searched online commands like:

"build:client": "parcel build client/index.html --out-dir dist/client",

or

 "build:server": "parcel build server/index.js --target node --out-dir dist/server",

or even more with this weird flag command: --watch

like image 868
hyden97 Avatar asked Jun 18 '26 11:06

hyden97


1 Answers

all you need to do for client part:

npx parcel build ./*.html

that will put result to ./dist directory

if you want now to serve the result on parcel dev server then do:

npx parcel ./*.html

the both urls will work

http://localhost:1234/ - will open you index

http://localhost:1234/aboutme.html - will open you 'about me'

And - if you modify index.html (in root dir, not in dist) - changes will be automatically pulled to your browser.

like image 84
Andrey Avatar answered Jun 20 '26 03:06

Andrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!