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

read-package-json raises an error when the package name is not valid #18

Open
rubeniskov opened this issue Oct 30, 2020 · 0 comments
Open

Comments

@rubeniskov
Copy link

rubeniskov commented Oct 30, 2020

Some libraries such as @apollo/client/react has no an standard package name so when webpack tries to compile raises an error like this, due read-package-json validation.

Error: Invalid name: "@apollo/client/react"
    at ensureValidName (.../node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:336:15)
    at Object.fixNameField (.../node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:215:5)
    at .../node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:32:38
    at Array.forEach (<anonymous>)
    at normalize (.../node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:31:15)
    at final (.../node_modules/read-package-json/read-json.js:424:5)
    at then (.../node_modules/read-package-json/read-json.js:156:5)
    at ReadFileContext.callback (.../node_modules/read-package-json/read-json.js:345:20)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13) undefined

I suggest to change the way package.json is loaded using the default require method which is nodejs standard, it will validate only the format and not follow the npm structure.

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

No branches or pull requests

1 participant