如何将 jsconfig.json 添加到现有 vscode 项目 w/o 破坏它
How to add jsconfig.json to existing vscode project w/o breaking it
我有 React 项目,目前没有使用 jsconfig.json
文件。
最近我在生成构建(纱线)时收到以下警告消息:
Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.
我看到"local fixes"添加base_urlhere here,但我担心它会破坏我在其他地方的构建。
在现有项目中解决此问题的最安全方法是什么?
jsconfig.json
中需要哪些额外设置?
还是我根本不担心而忽略它?
Setting NODE_PATH to resolve modules absolutely has been deprecated in
favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are
using TypeScript) and will be removed in a future major release of
create-react-app.
这是一个警告,指出您在项目中使用的绝对路径方法,即在 .env
中添加 NODE_PATH
将被弃用,有利于在 [=13] 中设置 baseUrl =] 或 tsconfig.json
要解决此问题,您可以在根目录中添加 jsconfig.json
或 tsconfig.json
并将 baseUrl 设置为 src
{
"compilerOptions": {
"baseUrl": "./src"
}
}
现在删除 .env
中的 NODE_PATH
,这不会破坏当前代码中的任何内容,并且会删除警告。
Note: paths
in jsconfig
or tsconfig
is still not supported in CRA
if you are planning to use this feature in your CRA project you have to wait
我有 React 项目,目前没有使用 jsconfig.json
文件。
最近我在生成构建(纱线)时收到以下警告消息:
Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.
我看到"local fixes"添加base_urlhere here,但我担心它会破坏我在其他地方的构建。
在现有项目中解决此问题的最安全方法是什么?
jsconfig.json
中需要哪些额外设置?
还是我根本不担心而忽略它?
Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.
这是一个警告,指出您在项目中使用的绝对路径方法,即在 .env
中添加 NODE_PATH
将被弃用,有利于在 [=13] 中设置 baseUrl =] 或 tsconfig.json
要解决此问题,您可以在根目录中添加 jsconfig.json
或 tsconfig.json
并将 baseUrl 设置为 src
{
"compilerOptions": {
"baseUrl": "./src"
}
}
现在删除 .env
中的 NODE_PATH
,这不会破坏当前代码中的任何内容,并且会删除警告。
Note:
paths
injsconfig
ortsconfig
is still not supported in CRA if you are planning to use this feature in your CRA project you have to wait