Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is storeConfigInMeta: false not the default in Ember CLI?

From http://ember-cli.com/user-guide/:

Application configurations from your ember-cli-build.js file will be stored inside a special meta tag in dist/index.html.

sample meta tag:

<meta name="user/config/environment" content="%7B%22modulePre.your.config">

This meta tag is required for your ember application to function properly. If you prefer to have this tag be part of your compiled javascript files instead, you may use the storeConfigInMeta flag in ember-cli-build.js.

// ember-cli-build.js
var app = new EmberApp({
  storeConfigInMeta: false
});

In production, this meta tag looks like

<meta name="app/config/environment" content="%7B%22modulePrefix%22%3A%app%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22...

and is quite long. Wouldn't it be more performant to make the configuration object part of the Javascript asset, rather than requiring the app to parse all of that text after it boots?

like image 844
Max Wallace Avatar asked May 19 '16 12:05

Max Wallace


1 Answers

By having it external to the JS payload, it's possible to change the meta tag to configure the JS app without having to recompile the app. It's quite useful in certain situations ...

like image 170
acorncom Avatar answered Nov 15 '22 09:11

acorncom