create-react-app VS code 无法自动补全 .env 文件

k4ymrczo  于 6个月前  发布在  React
关注(0)|答案(2)|浏览(71)

VS Code在自动补全以REACT_APP开头的变量时,无法在create react app的process.env中找到。有什么建议吗?

我在项目的根目录创建了一个.env文件,如下所示:

lvjbypge

lvjbypge1#

请更新package.json文件以供参考。

roejwanj

roejwanj2#

{ "name": "frontend", "version": "0.1.0", "private": true, "dependencies": { "@azure/msal-browser": "^2.26.0", "@azure/msal-react": "^1.4.2", "@ckeditor/ckeditor5-build-classic": "^35.2.0", "@ckeditor/ckeditor5-react": "^5.0.2", "@emotion/react": "^11.9.3", "@emotion/styled": "^11.9.3", "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^13.5.0", "axios": "^0.27.2", "bootstrap": "^5.2.2", "env-cmd": "^10.1.0", "html-react-parser": "^3.0.4", "js-base64": "^3.7.2", "jspdf": "^2.5.1", "react": "^18.2.0", "react-bootstrap": "^2.5.0", "react-bootstrap-icons": "^1.9.1", "react-dom": "^18.2.0", "react-hook-form": "^7.37.0", "react-lorem-ipsum": "^1.4.10", "react-router-dom": "^5.3.3", "react-scripts": "^5.0.1", "react-to-print": "^2.14.7", "recoil": "^0.7.6", "sass": "^1.55.0", "web-vitals": "^2.1.4" }, "resolutions": { "//": "See https://github.com/facebook/create-react-app/issues/11773", "react-error-overlay": "6.0.9" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

相关问题