Skip to content

Commit

Permalink
fix: fix intellisense for env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hakula139 committed Dec 22, 2021
1 parent 51cf635 commit f67266b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL = ws://localhost:5000
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL = ws://localhost:5000
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"prettier-eslint": "^13.0.0",
"prettier-eslint-cli": "^5.0.1",
"tailwindcss": "^2.2.19",
"typescript": "^4.5.2",
"unplugin-vue-components": "^0.17.2",
"typescript": "^4.5.4",
"unplugin-vue-components": "^0.17.9",
"vite": "^2.6.14",
"vite-tsconfig-paths": "^3.3.17",
"vue-eslint-parser": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const { BASE_URL, PROD } = import.meta.env;
export const { BASE_URL, PROD, VITE_API_URL } = import.meta.env;
8 changes: 8 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any>;
export default component;
}

interface ImportMetaEnv {
readonly VITE_API_URL: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
4 changes: 3 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

import { BASE_URL } from '@/configs';

const RootLayout = () => import(/* webpackChunkName: "root-layout" */ '@/views/RootLayout.vue');

const routes: Array<RouteRecordRaw> = [
Expand All @@ -11,7 +13,7 @@ const routes: Array<RouteRecordRaw> = [
];

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHistory(BASE_URL),
routes,
});

Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1097,9 +1097,9 @@ camelcase@^5.0.0, camelcase@^5.3.1:
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

caniuse-lite@^1.0.30001272, caniuse-lite@^1.0.30001286:
version "1.0.30001291"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001291.tgz#08a8d2cfea0b2cf2e1d94dd795942d0daef6108c"
integrity sha512-roMV5V0HNGgJ88s42eE70sstqGW/gwFndosYrikHthw98N5tLnOTxFqMLQjZVRxTWFlJ4rn+MsgXrR7MDPY4jA==
version "1.0.30001292"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz#4a55f61c06abc9595965cfd77897dc7bc1cdc456"
integrity sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==

chalk@^1.1.3:
version "1.1.3"
Expand Down Expand Up @@ -1626,9 +1626,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.4.17:
version "1.4.25"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.25.tgz#ce95e6678f8c6893ae892c7e95a5000e83f1957f"
integrity sha512-bTwub9Y/76EiNmfaiJih+hAy6xn7Ns95S4KvI2NuKNOz8TEEKKQUu44xuy0PYMudjM9zdjKRS1bitsUvHTfuUg==
version "1.4.26"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.26.tgz#d71b9da220543cf10614a576c3d5ebbe43d96efb"
integrity sha512-cA1YwlRzO6TGp7yd3+KAqh9Tt6Z4CuuKqsAJP6uF/H5MQryjAGDhMhnY5cEXo8MaRCczpzSBhMPdqRIodkbZYw==

emmet@^2.3.0:
version "2.3.5"
Expand Down Expand Up @@ -4922,7 +4922,7 @@ typescript@^3.2.1, typescript@^3.9.3:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8"
integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==

typescript@^4.4.3, typescript@^4.5.2:
typescript@^4.4.3, typescript@^4.5.4:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==
Expand All @@ -4947,7 +4947,7 @@ [email protected], unpipe@~1.0.0:
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=

unplugin-vue-components@^0.17.2:
unplugin-vue-components@^0.17.9:
version "0.17.9"
resolved "https://registry.yarnpkg.com/unplugin-vue-components/-/unplugin-vue-components-0.17.9.tgz#a2acc9b4e073f52df82d2036a318d76f0c66538b"
integrity sha512-SZrK3T/uEoP2g2bH+8DwBznoqlS0dI7kQvCmHmL8HmTXdM78kh5P/9SN5IwuNpfbmXoGXWJPB8Pr8Ke8zsgpmA==
Expand Down Expand Up @@ -5021,9 +5021,9 @@ vite-tsconfig-paths@^3.3.17:
tsconfig-paths "^3.9.0"

vite@^2.6.14:
version "2.7.4"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.4.tgz#06f68f8909943f9fe582c26120b0c2b85894a05e"
integrity sha512-f+0426k9R/roz5mRNwJlQ+6UOnhCwIypJSbfgCmsVzVJe9jTTM5iRX2GWYUean+iqPBWaU/dYLryx9AoH2pmrw==
version "2.7.5"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.5.tgz#dd04fb0a02ddc97e63800f878f34aa9e167df9ff"
integrity sha512-Bx8Iph9IJn6pWcErPkHKnyPABGMwK/vcdA0+V4TRC8TJFA7Zf6Xd1lRoUzsHHWUM8J+iUKKEuuNqqQUoxY3XvQ==
dependencies:
esbuild "^0.13.12"
postcss "^8.4.5"
Expand Down Expand Up @@ -5138,9 +5138,9 @@ vscode-uri@^2.1.2:
integrity sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==

vscode-uri@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.2.tgz#ecfd1d066cb8ef4c3a208decdbab9a8c23d055d0"
integrity sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==
version "3.0.3"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.3.tgz#a95c1ce2e6f41b7549f86279d19f47951e4f4d84"
integrity sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==

[email protected]:
version "0.29.8"
Expand Down

1 comment on commit f67266b

@vercel
Copy link

@vercel vercel bot commented on f67266b Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.