Reactjs %WebStorm上的公共URL%编辑器警告
带有create react app的WebStorm在Reactjs %WebStorm上的公共URL%编辑器警告,reactjs,intellij-idea,webstorm,create-react-app,Reactjs,Intellij Idea,Webstorm,Create React App,带有create react app的WebStorm在/public/index.html文件中有一个指向/public的文件夹路径,标记为%public\u URL% 它找不到目录%PUBLIC\u URL%,因为它不存在,也不应该存在 除了用抑制错误外,Webstorm中是否有方法将目录变量(如%PUBLIC\u URL%)别名到/PUBLIC的根路径,以确保开发中没有编辑器错误 <head> <meta charset="utf-8"> <m
/public/index.html
文件中有一个指向/public
的文件夹路径,标记为%public\u URL%
它找不到目录%PUBLIC\u URL%
,因为它不存在,也不应该存在
除了用
抑制错误外,Webstorm中是否有方法将目录变量(如%PUBLIC\u URL%
)别名到/PUBLIC
的根路径,以确保开发中没有编辑器错误
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
反应应用程序
这篇文章似乎对这一点有了更多的了解:这是一个很好的时间来解决这个看起来很时髦的%PULIC_URL%标签。还记得我们在将资产放入公用文件夹时提供的“转义图案填充”吗?在构建过程中,将识别并遵循以%PULIC_URL%标记为前缀的资产。但是,这不是最佳做法,只有在必要时才应使用
因此,在大多数情况下,您可以将%PUBLIC\u URL%替换为类似PUBLIC的内容,但当然,这取决于您如何构建React项目。没有办法;如果您关心这些警告,并且抑制它们不是一种方法,请尝试用实际路径替换它们