Closed naissa12 closed 2 years ago
hey @naissa12 spacetime uses es-modules on main, but builds common-js files as well. You can see the setup here. I think this mostly follows best-practice. I'm not sure how jest is configured. cheers
@naissa12 did you find a solution— I just hit the same issue upgrading from 6.12.3 -> 7.1.2
@naissa12 did you find a solution— I just hit the same issue upgrading from 6.12.3 -> 7.1.2
Can confirm that reverting from back to 6.12.3 fixes the issue in jest.
@spencermountain probably related to this: [change] - convert to ES-modules, + exports fields
I'm not ready to open a new issue yet but it's odd to me as we just tried to bump the version for the: [change] - update to 2022 DST dates
@spencermountain — I fixed it on my end; please disregard ^. And THANK YOU for all your hard work; My feedback for releases would be isolate DST updates from everything else— I assume most people version bump the package for the DST updates (or they're responsible and properly manage their packages 😂 ), which when rolled in with other things might cause some folks 🙋♂️ a bit of a headache (especially if they've waited until the last minute like yours truly). But seriously appreciate all that you do.
@naissa12 try updating
"spacetime": "^7.1.2",
"@babel/core": "^7.17.5",
"@babel/preset-env": "^7.16.11",
transformIgnorePatterns: [
'<rootDir>/node_modules/(?!spacetime)'
],
it may be as simple as adding <rootDir>/
for you, or you may need to play around with bumping additional modules surrounding babel and jest— best of luck!
I hope no one else wastes 6 hours on this 🙉 🙊 🙈
I came across this using when using jest@27. Updating both ts-jest and jest to ^28 seems to have fixed this for me.
For people who couldn't solve by adding the line:
transformIgnorePatterns: [ '
/node_modules/(?!spacetime)' ],
This doesn't work if your babel file is saved as .babelrc
Further information: https://stackoverflow.com/a/54656593/12959962
Hi, I tried the above tips, but unfortunately nothing helped and still getting same module issue with spacetime. I am using spacetime with react-timezone-component. Any ideas what I am doing wrong?
{
"transformIgnorePatterns": ["<rootDir>/node_modules/(?!spacetime)"]
}
2. babel.config.json
{ "presets": [ ["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript", "@babel/preset-react" ] }
3. package.json
devDep:
"@babel/core": "^7.23.5", "@babel/preset-env": "^7.23.5", "@babel/preset-react": "^7.22.15", "@babel/preset-typescript": "^7.23.3", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0",
deps:
` "spacetime": "^7.4.8"`
I running jest test file and getting the following error:
I tried to fix it by adding the following to package.json, but that didn't work: