简体   繁体   English

从Ember插件index.js访问Acces environment.js

[英]Acces environment.js from Ember addon index.js

I am building a Ember addon and I will like to know if there is a way to access the config/environment.js file from the root index.js. 我正在构建一个Ember插件,我想知道是否存在从根index.js访问config / environment.js文件的方法。 Basically I would like have the same config value used from the root index.js and a component. 基本上,我希望具有与根index.js和组件相同的配置值。

Thanks 谢谢

const config = this.project.config()

You can simply require it: 您可以简单地require它:

// index.js
var environment = 'production'; // optional
var ENV = require('config/environment')(environment);
console.log(ENV.baseURL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM