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

Fix: avoid mutating nextConfig #598

Merged
merged 9 commits into from Jul 27, 2022
Merged

Conversation

davesnx
Copy link
Contributor

@davesnx davesnx commented Jul 27, 2022

While updating to beta.10, I got a TypeError on i18n.

This PR 'solves' the issue, but gives back a bunch of json-schema validation errors. I preferred to create a PR half-backed than open an issue.

TypeError: Cannot create property 'i18n' on string 'phase-development-server'
    at withNextra (/Users/davesnx/Code/github/davesnx/styled-ppx/packages/website/node_modules/nextra/dist/index.js:207:21)
    at Object.normalizeConfig (/Users/davesnx/Code/github/davesnx/styled-ppx/packages/website/node_modules/next/dist/server/config-shared.js:123:18)
    at Object.loadConfig [as default] (/Users/davesnx/Code/github/davesnx/styled-ppx/packages/website/node_modules/next/dist/server/config.js:74:53)
    at async NextServer.prepare (/Users/davesnx/Code/github/davesnx/styled-ppx/packages/website/node_modules/next/dist/server/next.js:115:24)
    at async /Users/davesnx/Code/github/davesnx/styled-ppx/packages/website/node_modules/next/dist/cli/next-dev.js:147:9
error Command failed with exit code 1.

Moved the file to TypeScript to avoid future problems. Not sure if it's desired, but I found myself doing something silly without TS, even in this PR.

@changeset-bot
Copy link

changeset-bot bot commented Jul 27, 2022

🦋 Changeset detected

Latest commit: 8c9b234

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nextra-theme-docs-dev ✅ Ready (Inspect) Visit Preview Jul 27, 2022 at 5:15PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
nextra ⬜️ Ignored (Inspect) Jul 27, 2022 at 5:15PM (UTC)

@davesnx
Copy link
Contributor Author

davesnx commented Jul 27, 2022

I'm unable to see the logs for Vercel – nextra-theme-docs-dev

Copy link
Collaborator

@promer94 promer94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you keep the js extensions and use commonjs export.
Otherwise it would have some compatibility issues

Screen Shot 2022-07-27 at 22 25 00

@davesnx
Copy link
Contributor Author

davesnx commented Jul 27, 2022

Done, but I would love to know the reason why it can't be defined under tsup.config.js as format: 'commonjs',?

@shuding
Copy link
Owner

shuding commented Jul 27, 2022

The Vercel – nextra-theme-docs-dev deployment is fixed now!

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
@promer94 promer94 merged commit a0398e0 into shuding:core Jul 27, 2022
@davesnx davesnx deleted the fix-i18n-error branch July 27, 2022 18:35
tatukoivisto pushed a commit to tatukoivisto/nextra that referenced this pull request Aug 20, 2023
* Fix: avoid mutating nextConfig

* Fix: pass defaulti18n to nextra/loader

* Refactor: make i18n mutation easier to read

* Refactor: migrate index to TS and create a default i18n

* Fix add index.ts tsup

* Revert migration to TS

* fix: wrong entry

* Update packages/nextra/src/index.js

Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: Yixuan Xu <yixuanxu94@outlook.com>
Co-authored-by: Dimitri POSTOLOV <en3m@ya.ru>
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 this pull request may close these issues.

None yet

4 participants