Import mixin into add-on in Ember cause "Uncaught Error: Could not find module"
Import mixin into add-on in Ember cause "Uncaught Error: Could not find module"
我正在 addon/component/my-component.js
中执行以下操作:
import Ember from 'ember';
import layout from '../templates/components/my-component';
import myMixin from '../mixins/my-mixin';
export default Ember.Component.extend(myMixin,{
layout
});
但是这样做给了我
Uncaught Error: Could not find module foo/mixins/my-mixin imported from foo/components/my-component
my-mixin.js
的路径是app/mixins/my-mixin
。
根据上述结构,如何导入我的 mixin?谢谢。
my-component.js
文件在 addon/component
目录中,因此将 my-mixin.js
文件放在 addon/mixins
目录中将解决您的问题。
我正在 addon/component/my-component.js
中执行以下操作:
import Ember from 'ember';
import layout from '../templates/components/my-component';
import myMixin from '../mixins/my-mixin';
export default Ember.Component.extend(myMixin,{
layout
});
但是这样做给了我
Uncaught Error: Could not find module foo/mixins/my-mixin imported from foo/components/my-component
my-mixin.js
的路径是app/mixins/my-mixin
。
根据上述结构,如何导入我的 mixin?谢谢。
my-component.js
文件在 addon/component
目录中,因此将 my-mixin.js
文件放在 addon/mixins
目录中将解决您的问题。