as this generates a static site I would like to deploy my vue app with an S3 bucket. When I build the app it says that it is meant to be deployed over an http server. Is there a way to deploy these static pages using s3?
Thank you
Hi,
I've created a SPA with this template and it's working fine in an S3 bucket. You just need to upload your dist/ folder to your bucket.
Pro tips:
index.html, I ran into some issues with this. To do that, I'm uploading the whole folder with no cache flags, and then reuploading the index.html with the --cache 0 flag, like this (package.json scripts): "deploy-s3": "s3-deploy --cwd './dist/' --profile YOUR_PROFILE --region YOUR_REGION --gzip --etag --bucket YOUR_BUCKET",
"deploy-s3-task": "npm run deploy-s3 -- './dist/**' && npm run deploy-s3 -- --cache 0 -- './dist/index.html'",
(make sure you npm run build your project before uploading it!)
Hope it helps.
@afontcu, that doesn't work for me, during the npm run build there is:
Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won't work.
How to build and serve plain static files without an HTTP server? For now my /dist/ folder alone doesn't work without some kind of HTTP server as mentioned during the default build process.
Hi @iharsuvorau,
that message only means that you cannot browser to file://whatever/path/you/are/using/index.html and expect your project to work.
Have you tried uploading it to S3? I just ran npm run build and uploaded the whole /dist/ and everything worked as expected.
Hope it helps!
Most helpful comment
Hi @iharsuvorau,
that message only means that you cannot browser to file://whatever/path/you/are/using/index.html and expect your project to work.
Have you tried uploading it to S3? I just ran
npm run buildand uploaded the whole/dist/and everything worked as expected.Hope it helps!