lundi 24 octobre 2016

ember build is not setting the correct rootUrl

Messing around with deploying, and I'm going to need to put the app outside the root url of the server. Based on this answer all I need to do is change the environment.js file to look like this.

module.exports = function(environment) {
    var ENV = {
        modulePrefix: 'ember-drupal',
        environment: environment,
        rootURL: '/',
        locationType: 'auto'
    };

    if (environment === 'production') {
        ENV.rootUrl = '/myApp/';
        ENV.locationType = 'hash';
    }
    return ENV;
};

So when I run

ember build --environment=production

I expect it to set the rootUrl to be /myApp/, yet when I load up localhost/myApp/ it gives me 404 saying that it's still looking for /assets/ instead of /myApp/assets.

Two interesting notes.

  1. If I change the default rootUrl to /myApp/, it works.
  2. The source code has a meta tag called "ember-drupal/config/environment". The content of the meta tag is json of my environment variables.

The 'ember build' command spits out this:

{
"modulePrefix":"ember-drupal",
"environment":"development",
"rootURL":"/",
"locationType":"auto",
"exportApplicationGlobal":true
}

And the 'ember build --environment=production' spits out this:

{
"modulePrefix":"ember-drupal",
"environment":"production",
"rootURL":"/",
"locationType":"hash",
"rootUrl":"/myApp/",
"exportApplicationGlobal":false
}

So it's setting the locationType correctly, but setting the rootUrl twice.




Aucun commentaire:

Enregistrer un commentaire