deepflow grafana plugin 编译问题解决

修改tsconfig.js 增加"noImplicitAny": false,解决代码类型没有指定,显示Any 错误

To solve the error, explicitly set the parameter's type to any, use a more specific type or set noImplicitAny to false in tsconfig.json.

https://bobbyhadz.com/blog/typescript-parameter-implicitly-has-an-any-type#:\~:text=The "Parameter 'X' implicitly has an 'any' type",type or set noImplicitAny to false in tsconfig.json.

{

"extends": "./.config/tsconfig.json",

"compilerOptions": {

"noImplicitAny": false

}

}

2.This syntax requires an imported helper but module 'tslib' cannot be found

pnpm install tslib@latest

https://bobbyhadz.com/blog/typescript-syntax-requires-imported-helper-but-module-tslib-cannot#:\~:text=To solve the error "This syntax requires an,IDE is using the correct (workspace) TypeScript version.

  1. 错误信息:

RROR in ./module.ts

Module build failed (from ../node_modules/.pnpm/swc-loader@0.2.6_@swc+core@1.4.17_@swc+helpers@0.4.36__webpack@5.91.0_@swc+core@1.4.17_@swc+h_rr3j462mo335la4upn5l7exuzi/node_modules/swc-loader/src/index.js):

Error: failed to handle: base_dir(`./src`) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other words, SWC does not know which directory should be used as a base directory. It can be deduced if `.swcrc` is used, but if not, there are many candidates. e.g. the directory containing `package.json`, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.

webpack 5.91.0 compiled with 1 error in 327 ms

Type-checking in progress...

thread '<unnamed>' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.180.19/src/path.rs:122:13:

base_dir(`./src`) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other words, SWC does not know which directory should be used as a base directory. It can be deduced if `.swcrc` is used, but if not, there are many candidates. e.g. the directory containing `package.json`, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.9.0

YOUR TYPESCRIPT VERSION: 4.9.5

Please only submit bug reports when using the officially supported version.

=============

assets by status 583 KiB [cached] 10 assets

./module.ts 39 bytes [built] [1 error]

ERROR in ./module.ts

Module build failed (from ../node_modules/.pnpm/swc-loader@0.2.6_@swc+core@1.4.17_@swc+helpers@0.4.36__webpack@5.91.0_@swc+core@1.4.17_@swc+h_rr3j462mo335la4upn5l7exuzi/node_modules/swc-loader/src/index.js):

Error: failed to handle: base_dir(`./src`) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other words, SWC does not know which directory should be used as a base directory. It can be deduced if `.swcrc` is used, but if not, there are many candidates. e.g. the directory containing `package.json`, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.

webpack 5.91.0 compiled with 1 error in 947 ms

解决: 降@swc/core 版本

pnpm install @swc/core@1.3.75

重新运行:

相关推荐
雯0609~3 分钟前
网页F12:缓存的使用(设值、取值、删除)
前端·缓存
℘团子এ6 分钟前
vue3中如何上传文件到腾讯云的桶(cosbrowser)
前端·javascript·腾讯云
学习前端的小z12 分钟前
【前端】深入理解 JavaScript 逻辑运算符的优先级与短路求值机制
开发语言·前端·javascript
soulteary22 分钟前
突破内存限制:Mac Mini M2 服务器化实践指南
运维·服务器·redis·macos·arm·pika
彭世瑜36 分钟前
ts: TypeScript跳过检查/忽略类型检查
前端·javascript·typescript
FØund40437 分钟前
antd form.setFieldsValue问题总结
前端·react.js·typescript·html
Backstroke fish37 分钟前
Token刷新机制
前端·javascript·vue.js·typescript·vue
小五Five38 分钟前
TypeScript项目中Axios的封装
开发语言·前端·javascript
小曲程序38 分钟前
vue3 封装request请求
java·前端·typescript·vue
临枫54139 分钟前
Nuxt3封装网络请求 useFetch & $fetch
前端·javascript·vue.js·typescript