Unexpected identifier in react-scripts test
DuyTungHa opened this issue · comments
The react-blockly is causing a "SyntaxError: Unexpected identifier" error when running test using the command "react-scripts test".
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import BlocklyEditor from './BlocklyEditor';
SyntaxError: Unexpected identifier
4 | import _ from 'lodash';
5 | import PropTypes from 'prop-types';
> 6 | import ReactBlockly from 'react-blockly';
| ^
7 | import Blockly from 'blockly';
8 | import Button from '@material-ui/core/Button';
9 | import Grid from '@material-ui/core/Grid';
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at Object.<anonymous> (src/components/blockly/Blockly.js:6:1)
Any ideas on how to fix this ?
Oh, interesting - this seems like react-blockly possibly isn't being properly transpiled during the build. Which version of react-blockly are you using in your project?
I'm using react-blockly@5.1.1
Thanks for bringing this to my attention! I've released react-blockly 5.3.0, which changes the build toolchain to transpile everything to ES5 in the package. This should fix the issue you ran into.