export-from-json
export-from-json copied to clipboard
Error: require() of ES Module /Users/xiangyanxia/fuxi/zb/zhongbao/node_modules/export-from-json/dist/umd/index.js from
When I use require('export-from-json'), it failed:
Error: require() of ES Module /Users/xiangyanxia/fuxi/zb/zhongbao/node_modules/export-from-json/dist/umd/index.js from /Users/xiangyanxia/fuxi/zb/zhongbao/packages/manage/test/component/TaskDataSetting/parse.test.ts not supported. index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/xiangyanxia/fuxi/zb/zhongbao/node_modules/export-from-json/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
And I found that in the package.json file, has a 'type="modile"' , so that I cant use require('export-from-json').
Faced the same issue
Faced the same issue