Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Unexpected token (161:57) (in CRA apps) #279

Open
aneeshpanoli opened this issue Aug 30, 2021 · 4 comments
Open

Module parse failed: Unexpected token (161:57) (in CRA apps) #279

aneeshpanoli opened this issue Aug 30, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@aneeshpanoli
Copy link

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

@aneeshpanoli aneeshpanoli added the bug Something isn't working label Aug 30, 2021
@daep93
Copy link

daep93 commented Sep 20, 2021

I have same issue when using Vue.js. I guess babel help this problem but I don't know how exactly.

@pviotti
Copy link

pviotti commented Oct 6, 2021

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).

@gadicc
Copy link
Owner

gadicc commented Oct 12, 2021

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.

@gadicc gadicc changed the title Module parse failed: Unexpected token (161:57) Module parse failed: Unexpected token (161:57) (in CRA apps) Oct 13, 2021
gadicc pushed a commit that referenced this issue Oct 13, 2021
## [1.14.6](v1.14.5...v1.14.6) (2021-10-13)

### Bug Fixes

* **pkg/esm:** target es2020->es2019: workaround old toolchains ([#279](#279)) ([ab63b27](ab63b27))
@gadicc
Copy link
Owner

gadicc commented Oct 13, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants