Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"Module not found: Error: Default condition should be last one" when using with create-react-app #6

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

Closed
trombipeti opened this issue Sep 2, 2024 · 4 comments · Fixed by #7

Comments

@trombipeti
Copy link
Contributor

trombipeti commented Sep 2, 2024

Can't use this package with our React project created with create-react-app.
Getting "Module not found: Error: Default condition should be last one".

After googling a bit, I've found this PR: firebase/firebase-js-sdk#7006

If I do the same, it works. I'll create PR, however, I'm not a 100% sure what's going on... :)

Important parts of package.json
``` { "name": "...", "version": "0.1.0", "private": true, "dependencies": { "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@fontsource/roboto": "^5.0.12", "@hookform/resolvers": "^3.3.4", "@mui/icons-material": "^5.14.3", "@mui/lab": "^5.0.0-alpha.138", "@mui/material": "^5.14.3", "@types/autobahn": "^20.9.1", "@types/jest": "^29.5.3", "@types/lodash.debounce": "^4.0.7", "@types/lodash.partial": "^4.2.7", "@types/lodash.partialright": "^4.2.7", "@types/node": "^20.4.8", "@types/react": "^18.2.18", "@types/react-dom": "^18.2.7", "@types/utf8": "^3.0.2", "@types/when": "^2.4.35", "allotment": "^1.20.0", "assert": "^2.0.0", "autobahn": "^22.11.1", "clsx": "^2.0.0", "d3fc-sample": "^3.0.5", "dexie": "^3.2.4", "dexie-react-hooks": "^1.1.6", "dockview": "^1.10.1", "echarts": "^5.5.0", "i18next": "^23.4.2", "lodash.clamp": "^4.0.3", "lodash.debounce": "^4.0.8", "lodash.partial": "^4.2.1", "lodash.partialright": "^4.2.1", "pretty-bytes": "^6.1.1", "pretty-format": "^29.7.0", "react": "^18.2.0", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", "react-dnd-touch-backend": "^16.0.1", "react-dom": "^18.2.0", "react-hook-form": "^7.50.1", "react-i18next": "^13.0.3", "react-router-dom": "^6.14.2", "react-scripts": "^5.0.1", "recharts": "^2.7.2", "stream": "npm:stream-browserify@^3.0.0", "typescript": "^5.1.6", "typescript-result": "^2.0.0", "use-resize-observer": "^9.1.0", "usehooks-ts": "^2.9.1", "utf8": "^3.0.0", "util": "^0.12.5", "web-vitals": "^3.4.0", "when": "^3.7.8", "zod": "^3.22.4" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "eslint-plugin-i18next": "^6.0.3", "fork-ts-checker-webpack-plugin": "^6.5.3", "i18next-parser": "^8.3.0", "jest-junit": "^16.0.0" }, "devDependenciesComments": { "fork-ts-checker-webpack-plugin": [ "Needed to make react-scripts work with Typescript 5", "see https://github.com/facebook/create-react-app/issues/13080#issuecomment-1515280885" ] }, "overrides": { "react-scripts": { "typescript": "^5" } }, "overridesComments": { "react-scripts": { "typescript": [ "Needed to make react-scripts work with Typescript 5", "see https://github.com/facebook/create-react-app/issues/13080#issuecomment-1515280885" ] } } }```
@everweij
Copy link
Owner

everweij commented Sep 2, 2024

Thanks for submitting this issue, and I'm glad you found this problem because others will encounter it sooner or later.

For what it's worth, the error about the 'default' condition is valid. More background: https://stackoverflow.com/questions/75153633/order-of-keys-in-package-json-exports

I will accept and merge your PR

@everweij everweij closed this as completed Sep 2, 2024
@trombipeti
Copy link
Contributor Author

Thanks! Do you have any plan regarding releases? It would be good if I could simply update the npm package in the project before merging our code, so that our pipeline doesn't break etc.

@everweij
Copy link
Owner

everweij commented Sep 3, 2024

Yes, I just released v2.1.0!

@trombipeti
Copy link
Contributor Author

Thank you very much :)

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

Successfully merging a pull request may close this issue.

2 participants