humberto
humberto

Reputation: 61

Issue for importing "@highcharts/highcharts-react-native" - Module parse failed: Unexpected toke

Module parse failed: Unexpected token (34:16)

I face a problem to use highcharts-react-native in react-native.

I followed the instructions in https://github.com/highcharts/highcharts-react-native, but I cannot run my react-native-app in browser.

My actions:

But, http://localhost:19006/ was showed like below

    Uncaught Error: Module parse failed: Unexpected token (34:16)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    |     }
    | 
    >     setHcAssets = async (useCDN) => {
    |         try {
    |             await this.setLayout()
        at Object../node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js (index.js:1)
        at __webpack_require__ (bootstrap:789)
        at fn (bootstrap:100)
        at Object../node_modules/@highcharts/highcharts-react-native/index.js (index.js:1)
        at __webpack_require__ (bootstrap:789)
        at fn (bootstrap:100)
        at Module../App.js (bootstrap:856)
        at __webpack_require__ (bootstrap:789)
        at fn (bootstrap:100)
        at Module../index.js (index.js:1)
        at __webpack_require__ (bootstrap:789)
        at fn (bootstrap:100)
        at Object.1 (tracing.js:7)
        at __webpack_require__ (bootstrap:789)
        at bootstrap:856
        at bootstrap:856

And

    ./node_modules/@highcharts/highcharts-react-native/src/HighchartsReactNative.js 34:16
    Module parse failed: Unexpected token (34:16)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    |     }
    | 
    >     setHcAssets = async (useCDN) => {
    |         try {
    |             await this.setLayout()
    console.<computed> @ index.js:1

Upvotes: 0

Views: 1532

Answers (1)

Sebastian Hajdus
Sebastian Hajdus

Reputation: 1560

It looks like there is a problem with the webpack configuration, take a look at this thread it describes a similar case.

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file."

Module parse failed: Unexpected token. react-native/index.js "typeof" operator

Upvotes: 1

Related Questions