Skip to content

fix: replace with statement for SWC strict mode compatibility#40

Merged
chenjiahan merged 1 commit intomainfrom
with_strict_mode_0507
May 7, 2025
Merged

fix: replace with statement for SWC strict mode compatibility#40
chenjiahan merged 1 commit intomainfrom
with_strict_mode_0507

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

with statement cannot be used in SWC's strict mode. When the HTML template contains code like import.meta.*, the SWC parser will report an error.

See https://github.com/web-infra-dev/rspack/actions/runs/14881877767/job/41792179946

image

Related test case: https://github.com/web-infra-dev/rsbuild/blob/v1.3.8/e2e/cases/server/base-url-env-var/index.test.ts

This PR uses a placeholder as a workaround to fix the parsing error.

@chenjiahan chenjiahan merged commit d8cce6c into main May 7, 2025
3 checks passed
@chenjiahan chenjiahan deleted the with_strict_mode_0507 branch May 7, 2025 14:54
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.

1 participant