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

Alternate (npx-pkg compatible) way to use max scope? #414

Open
berndnoll opened this issue Nov 5, 2021 · 6 comments
Open

Alternate (npx-pkg compatible) way to use max scope? #414

berndnoll opened this issue Nov 5, 2021 · 6 comments

Comments

@berndnoll
Copy link

Hi there,
great library, your work is very much appreciated!
I have an issue with packaging the library into a standalone executable. (pkg)

const LPN = require("libphonenumber-js/max")

When I execute it gives me

pkg/prelude/bootstrap.js:1697 throw error; ^ Error: Cannot find module 'libphonenumber-js/max'
According to pkg logs it does include all the files in subdirectory max.
Not sure if this is specific to this lib or a general pkg problem.
Any advice on how to use the max version in a pkg package? Any workarounds?

Thanks
Bernd

@catamphetamine
Copy link
Owner

Hi.

Any advice on how to use the max version in a pkg package?

I guess none.
I haven't ever hear of that "pkg" thing.

@berndnoll
Copy link
Author

What about using max as a default instead of min?

@catamphetamine
Copy link
Owner

What about using max as a default instead of min?

What?

@berndnoll
Copy link
Author

I am talking about the metadata set. Why not make "max" the default metadata set instead of "min".
Or is there any other way to use the "max" set without using require("libphonenumber-js/max")?

Documentation I refer to:
`This library provides different "metadata" sets, "metadata" being a list of phone number parsing and formatting rules for all
countries. The complete list of those rules is huge, so this library provides a way to optimize bundle size by choosing between max, min, mobile and "custom" metadata:

max — The complete metadata set, is about 145 kilobytes in size (libphonenumber-js/metadata.full.json). Choose this when you need the most strict version of isValid(), or if you need to detect phone number type ("fixed line", "mobile", etc).`

@catamphetamine
Copy link
Owner

Why not make "max" the default metadata set instead of "min".

Because of the size. See the readme.

Or is there any other way to use the "max" set without using require("libphonenumber-js/max")?

No.

@gabriellett
Copy link

I'm facing the same issue when trying to use this library submodules with pkg. It seems like pkg is not packaging it correctly.

Could be something with the way submodules were setup here, because with other libraries, like lodash it works when importing submodules.

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

No branches or pull requests

3 participants