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

1.1k Views Asked by At

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
1

There are 1 best solutions below

1
Sebastian Hajdus On