reactjs - 模块解析失败:运行弹出后出现意外令牌
问题描述
希望有一个快速的解决方案。我刚刚在 typescript 内置的 React 应用程序上进行了弹出,以查看是否可以解决不同的问题。在尝试编译时,我现在收到此错误:
Module parse failed: Unexpected token (27:19)
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.
| }).catch(e => {
| // remove sensitive fields
> if (e.config?.data) delete e.config.data;
| if (e.response?.config?.data) delete e.response.config.data;
| super.analyticsHandler.error(`POST ${url} failed`, e);
我的猜测是delete
导致问题的部分,但我不是 100%。也许我错过了一个 babel 插件?该项目在弹出之前正在编译。
如果您需要查看代码/配置的任何特定部分,请告诉我。
谢谢
编辑:这是 package.json 中的 babel 部分:
"babel": {
"plugins":
[
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"babel-plugin-transform-typescript-metadata"
],
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
]
}
解决方案
推荐阅读
- swift - Alamofire:错误域=NSURLErrorDomain 代码=-1004“无法连接到服务器。” 在同一应用会话中尝试从 https 切换到 http
- java - 我想使用 Glen K. Peterson 的 Pdf Layout Manager 构建一个 PDF 文档,但我坚持构建一个表格
- inno-setup - 在 Inno Setup 中使用 3rd 方 API 的代理和虚拟机过滤器
- html - 如何缩小引导程序中jumbotron和about部分之间的差距
- c++ - 将 null 传递给 dlclose()
- python - Python mongoengine - 获取最后一个条目的 ID
- jmeter - 如何使用随机函数增加 Jmeter 中的时间戳
- python - 关于使用python自动化的问题
- neovim - 如何根据pyenv / virtualenv在neovim中为python语言服务器设置python解释器
- apache-kafka - 架构注册表允许奇怪的 avro 架构更改