我有一个Testimonials/index.js文件,它是组件pod的接口。
一切都很好,但是在产品构建之后,它的行为就像文件被省略了一样。
所以如果我添加一些日志,比如
import './Testimonials.less';
console.log('index File');
export { default } from './Testimonials.component';我没有看到那个日志(组件是从components/Testimonials导入的,工作正常)。
如果我将其替换为
import './Testimonials.less';
console.log('index File');
import Testimonials from './Testimonials.component';
export default Testimonials;它的工作方式与预期一致
有没有办法挖到哪里?
附注:示例是正确的
1)它起作用了
2)它在https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export中被描述为Aggregating modules
发布于 2019-07-22 22:29:50
我认为这不是正确的出口方式。
export { default } from './Testimonials.component';应该是这样的
export { name1, name2, …, nameN };这项工作做得很完美
import Testimonials from './Testimonials.component';
export default Testimonials;因为在您的Testimonials.component中已经导出了证言变量,所以可以像这样导入
export default是js的关键字
https://stackoverflow.com/questions/57143061
复制相似问题