Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing tslib dependency? #248

Closed
vinsonchuong opened this issue Jan 7, 2020 · 9 comments · Fixed by #264, #643 or #645
Closed

Missing tslib dependency? #248

vinsonchuong opened this issue Jan 7, 2020 · 9 comments · Fixed by #264, #643 or #645

Comments

@vinsonchuong
Copy link

vinsonchuong commented Jan 7, 2020

Hello! I'm currently using @date-io/dayjs@2.0.1 and I'm getting the following error:

Error: Cannot resolve dependency 'tslib'

I see the import in the compiled files build/index.esm.js and build/index.js, but there's no runtime dependency specified in package.json

@favna
Copy link

favna commented Jan 15, 2020

tslib is a dependency that comes standard with TypeScript and gets used in the build when the tsconfig has the option importHelpers set to true. The easiest solution is for you to npm install tslib / yarn add tslib (or write your app in TypeScript, which is better than regular JS anyway)

@HeVictor
Copy link
Contributor

It appears this issue may still be occurring and is breaking this CodeSandbox demo that does not have a tslib dependency in itself. Is it still possible to consider adding a runtime dependency for tslib in the package.json within @date-io?

@dmtrKovalenko
Copy link
Owner

@HeVictor feel free to open a PR with the correct tslib version. I can quicly publish a new version if it will be ok to merge

@LukasTy
Copy link
Contributor

LukasTy commented Mar 15, 2023

@dmtrKovalenko I was also looking into possible solutions to mui/mui-x#8205
I see two possible courses of action:

  1. add tslib as a dependency or a peer dependency to the hijri and jalaali packages
  2. bump target of the transpiled TS code to ES6 in order to reap the benefit of native support for class extending

  1. This is easiest to do, but I'm not a fan of this approach due to the need for users to have an additional dependency even though they might technically not need it.
  2. This would be the best but raises a question of minimum system support. Is there an explicit or preferred system support for @date-io libraries? I couldn't find one... Raising target to ES6 would no longer support IE11 and Opera Mini.

@dmtrKovalenko
Copy link
Owner

I think the minimum supported browsers should match latest http://mui.com (https://mui.com/material-ui/getting-started/supported-platforms/#browser) which explicitly declares that date picker can not support IE11 so I would probably bump a target.

But wait, why we need to add dependency only for 2 packages?

@dmtrKovalenko dmtrKovalenko reopened this Mar 15, 2023
@LukasTy
Copy link
Contributor

LukasTy commented Mar 15, 2023

I think the minimum supported browsers should match latest http://mui.com

Well, that's a good point, but on the page you linked there is a link to browserlistrc file and specifies op_mini all as supported version and that is either an issue on MUI side (because it has even worse feature support than IE11) or we can't bump the target. 🤔

But wait, why we need to add dependency only for 2 packages?

Well, they are the only ones that have tslib import in their production (built) code (because they are extending base adapter classes): hijri & jalaali. Whereas other packages like dayjs do not have this dependency.

@dmtrKovalenko
Copy link
Owner

Ok clear so I think either option is ok.

@HeVictor
Copy link
Contributor

Have updated my PR in #643 to go with option 1 for the time being

@LukasTy
Copy link
Contributor

LukasTy commented Mar 20, 2023

I've opened a PR changing the target of the built code to ES6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants