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

transpile to es2018

Open mxmul opened this issue 2 months 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