-
Notifications
You must be signed in to change notification settings - Fork 944
Open
Description
Downshift@9.x added an exports to package.json:
"exports": {
".": {
"import": "./dist/downshift.esm.js",
"require": "./dist/downshift.cjs.js",
"types": "./typings/index.d.ts",
"default": "./dist/downshift.esm.js"
},
"./react-native": {
"require": "./dist/downshift.native.cjs.js",
"types": "./typings/index.d.ts"
}
},
This makes jest import the esm and not the cjs version. This can be handled by adding this jest-config:
"transformIgnorePatterns": [
"node_modules/(?!(downshift|@babel/runtime)/)"
],
But because the esm-file contain direct imports to other esm-packages they will give and error for the nested dependency
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
import _extends from '@babel/runtime/helpers/esm/extends';
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';The error:
Must use import to load ES Module: node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
We are using @swc/jest
"transform": {
"^.+\\.(ts|js|tsx|jsx)$": "@swc/jest",
"^.+\\.css$": "<rootDir>/test/style-mock.js"
},
Anyone able to get it working with jest?
charliematters
Metadata
Metadata
Assignees
Labels
No labels