react-timezone-select icon indicating copy to clipboard operation
react-timezone-select copied to clipboard

Module not found: Error: Package path . is not exported in react-timezone-select

Open alex-ohadi opened this issue 1 year ago • 1 comments

Describe the bug

Latest version that works [email protected] works Breaking change starts here: [email protected]

Current Webpack version installed "webpack": "^5.95.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.1.0", "webpack-shell-plugin-next": "^2.3.2"

Error message:

Module not found: Error: Package path . is not exported from package in /node_modules/react-timezone-select

Reproduction

yarn start

System Info

Current Webpack version installed
    "webpack": "^5.95.0",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^5.1.0",
    "webpack-shell-plugin-next": "^2.3.2"

Used Package Manager

yarn

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

alex-ohadi avatar Oct 15 '24 19:10 alex-ohadi

I noticed that in the newer version

"exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" } },

./dist/index.cjs was removed

alex-ohadi avatar Oct 15 '24 19:10 alex-ohadi

any workaround, for a really simple use case this has been a dead end.

@ndom91

zthomas1 avatar Oct 30 '24 14:10 zthomas1

@alex-ohadi did you find another options?

zthomas1 avatar Oct 30 '24 15:10 zthomas1

Yup, I just removed this feature entirely and got the timezone based on the browser. Alex OhadiOn Oct 30, 2024, at 7:19 AM, zthomas1 @.***> wrote: any workaround, for a really simple use case this has been a dead end.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

alex-ohadi avatar Oct 30 '24 17:10 alex-ohadi

const [timezone] = useState( Intl.DateTimeFormat().resolvedOptions().timeZone)

You can get various abbreviations and offsets by tweaking this output const abbrev = new Intl.DateTimeFormat('en-US', options).formatToParts(date); const date = new Date(); const offset = date.getTimezoneOffset();

alex-ohadi avatar Oct 30 '24 17:10 alex-ohadi

Yeah this component is ESM-only. I won't be publishing cjs versions anymore 🙏

ndom91 avatar Feb 12 '25 13:02 ndom91