After upgrading date-fns to version 3.6.0 the parcel build started failing, not finding the exported functions. Apart from that the runtime function calls in the dev server fails with provided errors documented in the reproduction repository.
Build should be successful and runtime function calls should work as described in the date-fns repository.
π― Current Behavior
Build fails unless specifying the alias function name. Runtime the format function throws an error.
Build error:
@parcel/core: node_modules/date-fns/index.mjs does not export 'format'
/Users/isakstarlander/git/date-fns-parcel-reproduction/formatImport.ts:17:10
16 |
> 17 | import { format } from "date-fns";
> | ^^^^^^
18 |
19 | function renderFormattedDate() {
Runtime error:
TypeError: Cannot read properties of undefined (reading 'y')
at format.mjs:378:21
at Array.map (<anonymous>)
at format (format.mjs:367:6)
at renderFormattedDate (formatImport.ts:10:26)
at ghM9m.date-fns (formatImport.ts:21:1)
at newRequire (index.0dd3d9d0.js:71:24)
at index.0dd3d9d0.js:122:5
at index.0dd3d9d0.js:145:3
π¦ Context
This issue prevents us from upgrading date-fns to the latest supported major version.
π bug report
After upgrading
date-fns
to version3.6.0
the parcel build started failing, not finding the exported functions. Apart from that the runtime function calls in the dev server fails with provided errors documented in the reproduction repository.This seems to be a problem for
parcel
builds in particular, a related issue indate-fns
can be found here: https://github.com/date-fns/date-fns/issues/3744π€ Expected Behavior
Build should be successful and runtime function calls should work as described in the
date-fns
repository.π― Current Behavior
Build fails unless specifying the alias function name. Runtime the
format
function throws an error.Build error:
Runtime error:
π¦ Context
This issue prevents us from upgrading
date-fns
to the latest supported major version.π» Code Sample
Reproduction repository: https://github.com/Milkywire/date-fns-parcel-reproduction
π Your Environment