NouanceLabs / payload-better-fields-plugin

This plugin aims to provide you with very specific and improved fields for the Payload admin panel.
MIT License
124 stars 2 forks source link

date-fns issue in 1.4.1 #79

Open wkentdag opened 1 month ago

wkentdag commented 1 month ago

I just upgraded my Payload deps to the latest 2.x packages, including bumping this package from 1.3.5 to 1.4.1. After upgrading, I get the following error on start / any payload CLI command:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './format/index.js' is not defined by "exports" in /path/to/my/project/node_modules/date-fns/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:366:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
    at resolveExports (node:internal/modules/cjs/loader:590:36)
    at Module._findPath (node:internal/modules/cjs/loader:664:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1126:27)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/path/to/my/project/@nouance/payload-better-fields-plugin/node_modules/date-fns-tz/format/index.js:8:37) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

The import statement for date-fns-tz looks fine, so I'm wondering if the error could be due to the fact that I also have date-fns installed as a direct dependency?

with npm: 10.5.0, node: 18.20.2:

  "dependencies": {
    "@azure/storage-blob": "^12.17.0",
    "@nouance/payload-better-fields-plugin": "^1.4.1",
    "@payloadcms/bundler-webpack": "^1.0.6",
    "@payloadcms/db-postgres": "^0.8.4",
    "@payloadcms/plugin-cloud-storage": "^1.1.2",
    "@payloadcms/richtext-lexical": "^0.11.1",
    "cross-env": "^7.0.3",
    "date-fns": "^3.6.0",
    "express": "^4.17.1",
    "payload": "^2.18.3",
    "payload-plugin-algolia": "^0.1.0",
    "payload-plugin-scheduler": "^0.0.3"
  },

It turns out I don't need any of the new updates so I reverted to 1.3.5 and the issue's gone. Just posting here for posterity!