Skip to content

Commit

Permalink
feat: 按环境启用 eruda 调试工具
Browse files Browse the repository at this point in the history
  • Loading branch information
yulimchen committed Feb 7, 2023
1 parent b028bb9 commit 9be036d
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 44 deletions.
5 changes: 4 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# baseUrl
# /dev-api 为本地 mock 地址,不使用 mock 的话此处换为你的开发环境接口地址,例如 http://192.168.233.233
VITE_BASE_API = '/dev-api'
VITE_BASE_API = '/dev-api'

# 启用 cdn eruda 调试工具
VITE_ENABLE_ERUDA = "true"
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
content="width=device-width,initial-scale=1.0,user-scalable=no"
/>
<link rel="icon" href="/favicon.ico" />
<title>Vite App</title>
<title>vue3-h5-template</title>
</head>
<body>
<div id="app">
Expand Down Expand Up @@ -51,5 +51,11 @@
</div>
</div>
<script type="module" src="/src/main.ts"></script>
<% if (ENABLE_ERUDA === "true") { %>
<script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>
eruda.init();
</script>
<% } %>
</body>
</html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"unplugin-vue-components": "^0.22.12",
"vite": "^4.0.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-mock-dev-server": "^0.3.16",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
Expand Down
194 changes: 194 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9be036d

Please sign in to comment.