You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running tests on a create-react-app build jest is unable to import react-pdf-highlighter components.
Details:
/mypath/node_modules/react-pdf-highlighter/build/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import PdfHighlighter from "./components/PdfHighlighter";
^^^^^^
SyntaxError: Cannot use import statement outside a module
The text was updated successfully, but these errors were encountered:
I've been tackling these problems trying to get react-pdf-highlighter working on a recent project. If you take a look at this comment on this thread you should see a basic fix for your problem: facebook/create-react-app#9938 (comment)
Essentially, CRA has problems with reading the "jest" property in package.json. Therefore, you need to edit the test script to include this at the end: react-scripts test --transformIgnorePatterns \"<rootDir>/node_modules/(?!react-pdf-highlighter)/\"
This will babel transpile the module during jest tests.
When running tests on a create-react-app build jest is unable to import
react-pdf-highlighter
components.The text was updated successfully, but these errors were encountered: