ember 中主机应用程序和插件的深度合并配置

Deep merging configs of host app and addon in ember

通常config/environment.js 宿主应用程序和插件的文件会合并。但仅限顶级。

例如:

//addon config/environment.js    
module.exports = function() {
    return {
        addonRootVar: 'exist after merge'
        APP: {
            addonDeepVar: 'doesn\'t exist in resulting config'
        }     
    }
}

//host app config/environment.js
module.exports = function() {
return {
    hostRootVar: 'exist after merge'
        APP: {
            hostDeepVar: 'whole APP property will be overwritten :('
        }
    }
}

是否可以进行 deepMerge 配置?(在生成的配置中同时存在 addonDeepVar 和 hostDeepVar)如果是 – 如何?

我错了。实际上配置默认合并(深)。但是每次 ember-cli 服务器启动时都会生成一次配置(文件更改时不会重新创建)。所以每次修改任何配置时,都必须重新启动服务器以避免不可预测性。