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

How to access prod build as a static application? #1163

Closed
DanielLuu opened this issue Dec 5, 2016 · 4 comments
Closed

How to access prod build as a static application? #1163

DanielLuu opened this issue Dec 5, 2016 · 4 comments

Comments

@DanielLuu
Copy link

DanielLuu commented Dec 5, 2016

Only familiar with deploying on the web with a docker container or some type of server. But is it possible to build the application and open it from the index.html generated? Thanks.

@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

The index.html contains absolute paths like /static/js/... so you can't just open it in the browser. You need to use any static file server . When you run npm run build, it prints exact instructions for running a simple HTTP server locally, so I hope those are helpful!

The reason it works that way is because this is necessary for most single-page apps. You don't want to load /todos/42/static/js/* when the user visits /todos/42. This is why we use absolute paths to assets by default as this is a very common mistake and a source of frustration.

@gaearon gaearon closed this as completed Dec 5, 2016
@DanielLuu
Copy link
Author

Ok my specific case is that I want to serve this through an iOS webview. Is that possible?

@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

As a temporary hack you can replace /static with ./static in all files as a post-build step.
We'll have some way of supporting this in the future but not right now.
You can track #1094 for this.

@DanielLuu
Copy link
Author

Thanks!

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants