When trying to import a component that uses @resouge/react-form inside a test file, Vitest throws the following error:
SyntaxError: Named export 'shallowClone' not found. The requested module '@resourge/shallow-clone' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@resourge/shallow-clone';
const { shallowClone } = pkg;
When trying to import a component that uses @resouge/react-form inside a test file, Vitest throws the following error:
SyntaxError: Named export 'shallowClone' not found. The requested module '@resourge/shallow-clone' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
import pkg from '@resourge/shallow-clone'; const { shallowClone } = pkg;
Reproducible example: https://stackblitz.com/edit/vitejs-vite-de68ru?file=package.json,src%2FAppModel.ts,src%2FApp.tsx,tests%2Findex.test.tsx&terminal=dev
run:
See error on Terminal.