google / google/closure-compiler

new dynamic import(path, {}) with options fail with [JSC_PARSE_ERROR] Parse error

Open
#4,189 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Closure compiler fails when it encounters any code that uses the new dynamic import() with options. Example code snippet that will break CC:

`
var _module = await import(cssPath, {
with: { type: "css" }
});
`

This throws a CC error:
`
ERROR - [JSC_PARSE_ERROR] Parse error. ')' expected
839| var _module = await import(cssPath, {
`

I understand the work around, but want to know when this will be supported OR is there any flags i can pass to bypass CC having to read/parse my code?

Using version:
closure-compiler-v20240317.jar with

ECMASCRIPT_2020 input/output and WHITESPACE_ONLY

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.