matrix-org / matrix-org/matrix-js-sdk

Next.js and swc minifier issue

Open
#2,942 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Hello there, I think have just found a library issue/bug when used together with next.js and its swc minifier, which it's commonly used now with next.js.

The steps to reproduce the issue are:

  • Create simplest next.js project
  • Set in the next.config.js the option swcMinify: true
  • Code the matrix usage like a import and usage of createClient in the homepage
  • Build with: next build && next export
  • View the static website using chrome gives the error Uncaught SyntaxError: missing ) in parenthetical 773-036ab45308f0e9db.js:6:21915. The static exported website it's not rendering properly.

If I set swcMinify: false or I remove the matrix dependency the problem vanishes.

Can someone investigate?
I can share you privately my test project to speedup if needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the simplest Next.js project, the next.config.js setting swcMinify: true, and the homepage usage of createClient. Run next build && next export, then view the exported site in Chrome and inspect the reported syntax error in 773-036ab45308f0e9db.js; done means the static site renders correctly with SWC minification enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.