react-scan icon indicating copy to clipboard operation
react-scan copied to clipboard

transpile to es2018

Open mxmul opened this issue 1 year ago • 2 comments

I've been using react-scan in a project with a legacy webpack 4 build, and noticed that the NPM dist uses modern syntax that can't be parsed. To work around, I've been running react-scan through babel-loader, but this PR should fix the problem.

It seems that webpack 4 uses acorn@6 to parse JS, and that it only supports es2018 syntax^1. Changing the compilation target for esnext to es2018 fixes the issue, and doesn't affect the build size too much (52kb -> 54kb).

Tested with a trivial webpack 4 config:

Before After
Screenshot 2024-12-05 at 6 58 18 PM Screenshot 2024-12-05 at 6 58 57 PM

mxmul avatar Dec 06 '24 00:12 mxmul

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
react-scan ⬜️ Skipped (Inspect) Dec 6, 2024 0:00am

vercel[bot] avatar Dec 06 '24 00:12 vercel[bot]

Someone is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 06 '24 00:12 vercel[bot]