问题描述
import React from 'react';
import Products from '../Products.js';
test('Should reorder list',() => {
const products = new Products();
...
});
但是当我运行它时,我收到一条错误消息,提示我正在使用的库中不允许导入
● Test suite Failed to run
.../node_modules/jimp/es/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import configure from '@jimp/custom';
^^^^^^
SyntaxError: Cannot use import statement outside a module
我的babel.config.json:
{
"presets": ["@babel/preset-env","@babel/preset-react"],"plugins": ["@babel/plugin-proposal-class-properties","@babel/plugin-proposal-object-rest-spread"]
}
我在做什么错?为何Jimp库无法使用该语法导入?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)