简体   繁体   中英

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. Basically I would like have the same config value used from the root index.js and a component.

Thanks

const config = this.project.config()

You can simply require it:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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