Skip to content

Try .mjs for Prettier, because web also tries to use prettier to format#4105

Open
FranjoMindek wants to merge 3 commits intomainfrom
franjo/prettier-fix-fix
Open

Try .mjs for Prettier, because web also tries to use prettier to format#4105
FranjoMindek wants to merge 3 commits intomainfrom
franjo/prettier-fix-fix

Conversation

@FranjoMindek
Copy link
Copy Markdown
Contributor

@FranjoMindek FranjoMindek commented May 4, 2026

Description

After we change .prettierrc to prettier.config.ts, Miho noticed that the main didn't manage to deploy web/ to cloudflare properly.
So I went to investigate.

Problems:

  • Our web/ deployment was pinned to NODE_VERSION=20 on Cloudflare via environment variables. This caused us to error when trying to import config from prettier.config.ts since that version of node can't work with TypeScript natively.

    • I find NODE_VERSION problematic since it diverges from .nvmrc version defined in the repo. Also as this version only exists in Cloudflare, so it's hard to track and remember.
    • Cloudflare by default searches for .nvmrc if NODE_VERSION is not set. So if we just delete the NODE_VERSION env var, the web/ node version should follow the repo version. Which I did.
  • The prettier.config.ts file imports the Config type from the prettier package, which means that if we don't npm i in the project root, loading prettier.config.ts will fail, since prettier package it tries to import type from does not exist. This means it becomes necessary to npm i to load the config.

    • I find this a regression to behavior from .prettierrc, so I converted TypeScript to JavaScript, which should work without any packages installed. I did the same for our Basic starter template.

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

@infomiho
Copy link
Copy Markdown
Member

infomiho commented May 4, 2026

Do a change in web to trigger Cloudflare build.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 4, 2026

Open in StackBlitz

@wasp.sh/wasp-cli

npx https://pkg.pr.new/@wasp.sh/wasp-cli@4105

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/@wasp.sh/wasp-cli-darwin-arm64-unknown@4105

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/@wasp.sh/wasp-cli-darwin-x64-unknown@4105

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/@wasp.sh/wasp-cli-linux-x64-glibc@4105

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/@wasp.sh/wasp-cli-linux-x64-musl@4105

commit: 39f7312

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 4, 2026

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 991a956
Status: ✅  Deploy successful!
Preview URL: https://4ad93841.wasp-docs-on-main.pages.dev
Branch Preview URL: https://franjo-prettier-fix-fix.wasp-docs-on-main.pages.dev

View logs

@FranjoMindek FranjoMindek marked this pull request as ready for review May 4, 2026 15:02
@FranjoMindek FranjoMindek requested a review from a team as a code owner May 4, 2026 15:02
@FranjoMindek FranjoMindek requested review from infomiho and removed request for a team May 4, 2026 15:02
Comment thread package.json
@@ -1,8 +1,9 @@
{
"name": "wasp-repo",
"type": "module",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should've added this with prettier.config.ts

@FranjoMindek FranjoMindek self-assigned this May 4, 2026
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.

2 participants