How do I deploy Ember.js app developed with ember-cli on github pages?

后端 未结 2 1509
故里飘歌
故里飘歌 2020-12-16 18:41

I have successfully created a small application using ember-cli. I tried pushing it to gh-pages branch of my github repo but it shows error in browser console



        
2条回答
  •  执笔经年
    2020-12-16 18:58

    As the comments already say: change the baseUrl in config/environment.js to the name of the GitHub repository you are pushing the app to. For example:

    Your GitHub respository is called myEmberApplication and resides in

    https://github.com/yourUsername/myEmberApplication.git

    then the URL to this project's gh-pages would be

    https://yourUsername.github.io/myEmberApplication

    So in your case you have to change the baseUrl from / (default) to /myEmberApplication.

    The reason why you have to do this is because ember-cli adds the header to your index.html file.

提交回复
热议问题