-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: Fix ECMAScript analyzer #8656
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Skipped Deployments
|
✅ This change can build |
🟢 Turbopack Benchmark CI successful 🟢Thanks |
|
a = ("" | `${a}x` | ???*0*) | ||
- *0* a | ||
⚠️ pattern without value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't look correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a test case would be great
### Description I faced this bug while working on vercel/turborepo#8523. Tree shaking inevitably creates direct imports for let bindings, and when the LHS of `+=` is imported/exported, it triggers a bug. The problematic input file looks like ```js // Combined load times for loading client components let clientComponentLoadStart = 0 let clientComponentLoadTimes = 0 let clientComponentLoadCount = 0 export function wrapClientComponentLoader(ComponentMod: any) { if (!('performance' in globalThis)) { return ComponentMod.__next_app__ } return { require: (...args: any[]) => { const startTime = performance.now() if (clientComponentLoadStart === 0) { clientComponentLoadStart = startTime } try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.require(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, loadChunk: (...args: any[]) => { const startTime = performance.now() try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.loadChunk(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, } } export function getClientComponentLoaderMetrics( options: { reset?: boolean } = {} ) { const metrics = clientComponentLoadStart === 0 ? undefined : { clientComponentLoadStart, clientComponentLoadTimes, clientComponentLoadCount, } if (options.reset) { clientComponentLoadStart = 0 clientComponentLoadTimes = 0 clientComponentLoadCount = 0 } return metrics } ``` and it works if I apply this PR or I replace `clientComponentLoadTimes += performance.now() - startTime` with `clientComponentLoadTimes = clientComponentLoadTimes + performance.now() - startTime`. ### Testing Instructions Test references changed quite a lot.
### Description I faced this bug while working on vercel/turborepo#8523. Tree shaking inevitably creates direct imports for let bindings, and when the LHS of `+=` is imported/exported, it triggers a bug. The problematic input file looks like ```js // Combined load times for loading client components let clientComponentLoadStart = 0 let clientComponentLoadTimes = 0 let clientComponentLoadCount = 0 export function wrapClientComponentLoader(ComponentMod: any) { if (!('performance' in globalThis)) { return ComponentMod.__next_app__ } return { require: (...args: any[]) => { const startTime = performance.now() if (clientComponentLoadStart === 0) { clientComponentLoadStart = startTime } try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.require(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, loadChunk: (...args: any[]) => { const startTime = performance.now() try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.loadChunk(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, } } export function getClientComponentLoaderMetrics( options: { reset?: boolean } = {} ) { const metrics = clientComponentLoadStart === 0 ? undefined : { clientComponentLoadStart, clientComponentLoadTimes, clientComponentLoadCount, } if (options.reset) { clientComponentLoadStart = 0 clientComponentLoadTimes = 0 clientComponentLoadCount = 0 } return metrics } ``` and it works if I apply this PR or I replace `clientComponentLoadTimes += performance.now() - startTime` with `clientComponentLoadTimes = clientComponentLoadTimes + performance.now() - startTime`. ### Testing Instructions Test references changed quite a lot.
### Description I faced this bug while working on vercel/turborepo#8523. Tree shaking inevitably creates direct imports for let bindings, and when the LHS of `+=` is imported/exported, it triggers a bug. The problematic input file looks like ```js // Combined load times for loading client components let clientComponentLoadStart = 0 let clientComponentLoadTimes = 0 let clientComponentLoadCount = 0 export function wrapClientComponentLoader(ComponentMod: any) { if (!('performance' in globalThis)) { return ComponentMod.__next_app__ } return { require: (...args: any[]) => { const startTime = performance.now() if (clientComponentLoadStart === 0) { clientComponentLoadStart = startTime } try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.require(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, loadChunk: (...args: any[]) => { const startTime = performance.now() try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.loadChunk(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, } } export function getClientComponentLoaderMetrics( options: { reset?: boolean } = {} ) { const metrics = clientComponentLoadStart === 0 ? undefined : { clientComponentLoadStart, clientComponentLoadTimes, clientComponentLoadCount, } if (options.reset) { clientComponentLoadStart = 0 clientComponentLoadTimes = 0 clientComponentLoadCount = 0 } return metrics } ``` and it works if I apply this PR or I replace `clientComponentLoadTimes += performance.now() - startTime` with `clientComponentLoadTimes = clientComponentLoadTimes + performance.now() - startTime`. ### Testing Instructions Test references changed quite a lot.
### Description I faced this bug while working on vercel/turborepo#8523. Tree shaking inevitably creates direct imports for let bindings, and when the LHS of `+=` is imported/exported, it triggers a bug. The problematic input file looks like ```js // Combined load times for loading client components let clientComponentLoadStart = 0 let clientComponentLoadTimes = 0 let clientComponentLoadCount = 0 export function wrapClientComponentLoader(ComponentMod: any) { if (!('performance' in globalThis)) { return ComponentMod.__next_app__ } return { require: (...args: any[]) => { const startTime = performance.now() if (clientComponentLoadStart === 0) { clientComponentLoadStart = startTime } try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.require(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, loadChunk: (...args: any[]) => { const startTime = performance.now() try { clientComponentLoadCount += 1 return ComponentMod.__next_app__.loadChunk(...args) } finally { clientComponentLoadTimes += performance.now() - startTime } }, } } export function getClientComponentLoaderMetrics( options: { reset?: boolean } = {} ) { const metrics = clientComponentLoadStart === 0 ? undefined : { clientComponentLoadStart, clientComponentLoadTimes, clientComponentLoadCount, } if (options.reset) { clientComponentLoadStart = 0 clientComponentLoadTimes = 0 clientComponentLoadCount = 0 } return metrics } ``` and it works if I apply this PR or I replace `clientComponentLoadTimes += performance.now() - startTime` with `clientComponentLoadTimes = clientComponentLoadTimes + performance.now() - startTime`. ### Testing Instructions Test references changed quite a lot.
Description
I faced this bug while working on #8523. Tree shaking inevitably creates direct imports for let bindings, and when the LHS of
+=
is imported/exported, it triggers a bug.The problematic input file looks like
and it works if I apply this PR or I replace
clientComponentLoadTimes += performance.now() - startTime
withclientComponentLoadTimes = clientComponentLoadTimes + performance.now() - startTime
.Testing Instructions
Test references changed quite a lot.