为什么 storeConfigInMeta: false 不是 Ember CLI 中的默认值?

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

来自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
});

在生产中,这个元标记看起来像

<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...

而且很长。将配置对象作为 Javascript 资产的一部分,而不是要求应用程序在启动后解析所有文本,这不是更高效吗?

通过将其置于 JS 负载外部,可以更改元标记来配置 JS 应用程序,而无需重新编译应用程序。它在某些情况下非常有用......

聚会晚了几年,但这GitHub comment from the original PR to add this config描述了作者的初衷。

基本上,在 Index.html 中进行配置允许 dist/ 下的 JS 工件在不同环境中保持一致。