hooks icon indicating copy to clipboard operation
hooks copied to clipboard

ERROR in ./node_modules/@feathersjs/hooks/esm/base.js 55:38

Open andysay opened this issue 2 years ago • 4 comments

ERROR in ./node_modules/@feathersjs/hooks/esm/base.js 55:38
Module parse failed: Unexpected token (55:38)
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
|     }
|     middleware(middleware) {
>         this._middleware = middleware?.length ? middleware : null;
|         return this;
|     }

how fix it?

andysay avatar Apr 25 '22 17:04 andysay

Your module loader needs to be configured to transpile this module using a modern version of Javascript (ES2018 or later I believe) - there is additional documentation on module loaders in the Feathers client API.

daffl avatar Apr 25 '22 18:04 daffl

Your module loader needs to be configured to transpile this module using a modern version of Javascript (ES2018 or later I believe) - there is additional documentation on module loaders in the Feathers client API.

okay, i'm added

  config.module.rules.push({
    test: /\.jsx?$/,
    exclude: /node_modules(\/|\\)(?!(@feathersjs|debug))/,
    loader: 'babel-loader'
  })

and still have this


Module parse failed: Unexpected token (59:34)                                                                                            friendly-errors 21:09:58
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| 
|   middleware(middleware) {
>     this._middleware = middleware?.length ? middleware : null;
|     return this;
|   }

andysay avatar Apr 25 '22 18:04 andysay

Whoops, just confirmed, the required preset is ES2020.

daffl avatar Apr 25 '22 18:04 daffl

preset

will be babel-loader or stay es2020 ?

andysay avatar Apr 25 '22 18:04 andysay