Skip to content

Commit

Permalink
feat: node polyfills
Browse files Browse the repository at this point in the history
  • Loading branch information
liov committed Nov 1, 2024
1 parent 957a9e8 commit be96691
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/uniapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"unocss-applet": "^0.8.2",
"unplugin-auto-import": "^0.18.3",
"vite": "5.2.8",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-restart": "^0.4.1",
"vue-i18n": "9.1.9",
"vue-tsc": "^2.1.6"
Expand Down
15 changes: 15 additions & 0 deletions client/uniapp/src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@
"navigationBarTitleText": "瞬间"
}
},
{
"path": "pages/user/active",
"type": "page",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "激活"
}
},
{
"path": "pages/user/login",
"type": "page",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/wopan/list",
"type": "page",
Expand Down
2 changes: 2 additions & 0 deletions client/uniapp/src/types/uni-pages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface NavigateToOptions {
"/pages/about/i18n" |
"/pages/moment/moment_detail" |
"/pages/moment/moment_list" |
"/pages/user/active" |
"/pages/user/login" |
"/pages/wopan/list" |
"/pages/wopan/login" |
"/pages/wopan/view";
Expand Down
3 changes: 2 additions & 1 deletion client/uniapp/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { visualizer } from 'rollup-plugin-visualizer'
import ViteRestart from 'vite-plugin-restart'

import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vitejs.dev/config/
export default ({ command, mode }) => {
// console.log(mode === process.env.NODE_ENV) // true
Expand Down Expand Up @@ -49,6 +49,7 @@ export default ({ command, mode }) => {
envDir, // 自定义env目录
// envPrefix: 'VITE_', // 由于第三方库已经使用了VITE_开头的环境变量,所以限制了不能自定义
plugins: [
nodePolyfills(),
UniPages({
exclude: ['**/components/**/**.*'],
routeBlockLang: 'json5', // 虽然设了默认值,但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/diamond

0 comments on commit be96691

Please sign in to comment.