从'./some-module';获取`export {默认为MyName};`以与Jest一起使用(create-react-app)

在使用以下语法在JS中重新导出模块时,我不断收到错误TypeError: Cannot read property 'default' of undefined

export {default as MyName} from './some-module';

这可与create-react-app一起使用,但随附的Jest测试无法处理。 Jest是否使用相同的babel预设?有办法使它起作用吗?

pspg44oec 回答:从'./some-module';获取`export {默认为MyName};`以与Jest一起使用(create-react-app)

事实证明,我欺骗自己认为这是语法问题,而实际上这是一个周期性的导入问题。

之前没有出现,因为应用程序以不同于测试的顺序导入了东西。

本文链接:https://www.f2er.com/3157404.html

大家都在问