node-yahoo-finance2
node-yahoo-finance2 copied to clipboard
Module parse failed: Unexpected token (161:57) (in CRA apps)
Bug Report
- Module parse failed: Unexpected token (161:57)
- You may need an additional loader to handle the result of these loaders.
Describe the bug
- React compile error after installing the library
Minimal Reproduction
- fresh install
yarn add yahoo-finance2
Environment
Browser or Node: Node
Node version (if applicable): v15.6.0
Npm version: 7.4.0
Library version (e.g. 1.10.1
): 1.14.4
Additional Context
error
ReactJS | ./node_modules/yahoo-finance2/dist/esm/src/lib/validateAndCoerceTypes.js 161:57 ReactJS | Module parse failed: Unexpected token (161:57) ReactJS | File was processed with these loaders: ReactJS | * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js ReactJS | You may need an additional loader to handle the result of these loaders. ReactJS | | /* istanbul ignore next */ ReactJS | | ReactJS | > const logObj = typeof process !== "undefined" && process?.stdout?.isTTY ? obj => console.dir(obj, { ReactJS | | depth: 4, ReactJS | | colors: true
I have same issue when using Vue.js. I guess babel help this problem but I don't know how exactly.
I had a similar failure with vanilla Create React App. It's due to this issue (lack of support for nullish coalescing operator), and this fix works (for me).
Hey all, thanks for the report and helpful links! I've been away but am back now, and have a simple fix in mind for this which I hope to implement this week or early next. Watch this space :) And thanks for your patience until now.
Hey all (cc: @musiice). Please try the latest version, it works around this CRA issue by compiling down to ES2019 instead of ES2020. Please do report back.