由于项目中要去掉eslint,意外出现了以下报错:
Module parse failed: Unexpected token (86:57)
File was processed with these loaders:
* ./node_modules/cache-loader/dist/cjs.js
* ./node_modules/babel-loader/lib/index.js
* ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| key: "alarmType",
| get: function get() {
> return AiModel.get('alarmType', this.alarmTypeId) ?? null;
| },
| set: function set(alarmType) {
@ ./src/api/FieldClassMap.ts 8:0-71 212:19-36 215:21-38
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://192.168.1.113:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts
解决:
找到项目中的tsconfig.json文件将配置项"target": "esnext"改为"target"