Using Vue-Cli (Vuejs) With Github Pages
Recently, I have found some issues with the Vue-CLI when I tried to use it with Github Pages (an amazing way to set up a quick prototype, I’ll prob write more about it in another blog).
This turns out to be super easy to fix, simply open
/config/index.js file and find the following lines.
Then change them to the following:
After fixing the first problem, pushing the changes to master. Then load up the relative URL, then I realised there is still nothing being displayed. Here are the console errors:
Looking at the build info in the terminal, it also says the build directory should be served over an HTTP server.
After looking around at the config more, I also found a relatively easy fix. Again open up
/config/index.js file and find the following line.
Now just change the absolute path to a relative path, then voila, everything should work on Github Pages as expected.
Also feel free to remove or comment out the warning in the terminal show above, since we have now fixed the problem. Within
build/build.js, the following snippet is responsible for showing the warning.