我可能想得太多了,但似乎无法弄清楚下面的第一个模块和第二个模块之间的区别。
第一个被WebStorm接受、解析并建议为“缺少导入语句”,然后拉出模块。然而,第二个简单地说“元素不被导出”。作为示例,我在末尾放置了一个ReactJS组件,它确实可以工作。
// first module - is being recognized as an exported module.
export default {
foo() {}
};
// second module - "Element is not exported"
const AnObject = {
foo2() {}
};
export default AnObject;
// ReactJS Example Component - works just as fine
const Component = React.createClass({
bar() {}
});
export default Component;AnObject和Component声明之间肯定是有区别的,尽管我看不出这对导出有什么影响。
谁能解释一下为什么我在使用WebStorm时会遇到这种情况?
发布于 2016-07-11 20:37:18
我在WebStorm 2016.2中工作得很好:

没有错误报告,我可以从它的用法导航到foo2定义,等等。
https://stackoverflow.com/questions/38289809
复制相似问题