alexmngn February 2016

Error while importing config file in Ember Addon

I am working on an addon for Ember but I can't find the right way to import the config file.

I currently import the config file that way, from my service:

import ENV from '../config/environment';

I am testing the addon from the dummy/app folder, but when I try to use my service, I get the following error:

Uncaught Error: Could not find module ember-my-addon/config/environment imported from ember-my-addon/services/my-service

It should grab the config file from the dummy/app/config/environment.js, or the config file of the app that installed the addon.

What would be the best practice to import this file?

Answers


Gaurav February 2016

You can use the addon ember-get-config

Alternatively, you can use the solution posted here:

http://discuss.emberjs.com/t/best-practices-accessing-app-config-from-addon-code/7006/19?u=gaurav0

Post Status

Asked in February 2016
Viewed 1,560 times
Voted 11
Answered 1 times

Search




Leave an answer