Skip to content

Commit

Permalink
fix(Vue-vite): access env variables via import.meta.env
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Sep 28, 2021
1 parent e361a3c commit fe14d1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vue-trello/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const routes: Array<RouteRecordRaw> = [
];

const router = createRouter({
history: createWebHistory('/awesome-web/vue-trello/'),
history: createWebHistory(import.meta.env.BASE_URL),
routes,
});

Expand Down
4 changes: 3 additions & 1 deletion packages/vue-trello/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

const isEnvProduction = process.env.NODE_ENV === 'production';

export default defineConfig({
base: '/awesome-web/vue-trello/',
base: isEnvProduction ? '/awesome-web/vue-trello/' : '/',
plugins: [vue()],
resolve: {
alias: {
Expand Down

0 comments on commit fe14d1e

Please sign in to comment.