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

NextJS Build breaks start <= end assertion in swc_common #8932

Closed
rishabh3112 opened this issue May 7, 2024 · 0 comments · Fixed by vercel/next.js#65602
Closed

NextJS Build breaks start <= end assertion in swc_common #8932

rishabh3112 opened this issue May 7, 2024 · 0 comments · Fixed by vercel/next.js#65602
Assignees
Labels
Milestone

Comments

@rishabh3112
Copy link

Describe the bug

NextJS issue for reference: vercel/next.js#65436

Issue is on a large codebase if a single instance of SourceMap (via Ark<SourceMap>) in Compiler is used for applying transforms as well as for minification ( as done by next-swc ), the BytePos fields gets overflowed in large repos.

Please check this repo and readme for more reference: https://github.com/rishabh3112/next-bug-large-repo?tab=readme-ov-file#investigations

Input code

https://github.com/rishabh3112/next-bug-large-repo?tab=readme-ov-file#investigations

Config

No response

Playground link (or link to the minimal reproduction)

https://github.com/rishabh3112/next-bug-large-repo

SWC Info output

No response

Expected behavior

Build to work fine

Actual behavior

Build breaks with:

thread '<unnamed>' panicked at <HOME_DIR>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_common-0.33.9/src/input.rs:31:9:
assertion failed: start <= end
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Version

same as used by next in v4.0.4, latest and canary

Additional context

Raising this here as was suggested by @icyJoseph here: vercel/next.js#65436 (comment)

I am willing to contribute / discuss if needed to fix this issue.

@rishabh3112 rishabh3112 changed the title NextJS Build breaks start <= end assertion in swc NextJS Build breaks start <= end assertion in swc_common May 7, 2024
@kdy1 kdy1 self-assigned this May 7, 2024
@kdy1 kdy1 added this to the Planned milestone May 7, 2024
kdy1 added a commit to vercel/next.js that referenced this issue May 13, 2024
### What?

Do not reuse `Compiler` instance.

### Why?

It exists only to support preserving comments from `print()` API for
modules created with `parse()` API, but it causes a problem for
`transform()` for very huge apps.

### How?

 - Closes swc-project/swc#8932
 - Fixes #48960
 - Fixes #65436
@kdy1 kdy1 modified the milestones: Planned, v1.5.6 May 14, 2024
panteliselef pushed a commit to panteliselef/next.js that referenced this issue May 20, 2024
### What?

Do not reuse `Compiler` instance.

### Why?

It exists only to support preserving comments from `print()` API for
modules created with `parse()` API, but it causes a problem for
`transform()` for very huge apps.

### How?

 - Closes swc-project/swc#8932
 - Fixes vercel#48960
 - Fixes vercel#65436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants