我有一个开玩笑的测试
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库无法使用该语法导入?