Using mixins with Ember-cli?

前端 未结 2 819
一向
一向 2021-02-20 03:32

I have a mixin app/mixins/ui-listener.js which I\'m struggling to use with Ember-CLI. I\'m trying to use the mixin with the following syntax:

import         


        
2条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 04:30

    Instead of adding ../ (or even worse ../../../) into your imports, you can go to your config/environment.js and check for the property modulePrefix. Let's say the prefix is app-client.

    Then, you can import by using import UIListen from 'app-client/mixins/ui-listener'; instead. Absolute works best if you are in a "deep" subroute, etc.

提交回复
热议问题