Skip to content

Commit

Permalink
fix(vite-alias): change @ to src alias path
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Sep 27, 2021
1 parent ab6d14d commit 96de3ea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/vue-trello/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Board from '@/views/Board.vue';
import Task from '@/views/Task.vue';
import Board from 'src/views/Board.vue';
import Task from 'src/views/Task.vue';

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

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

Expand Down
4 changes: 2 additions & 2 deletions packages/vue-trello/src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createStore } from 'vuex';
import { getDefaultBoard } from '@/services';
import type { BoardType } from '@/services';
import { getDefaultBoard } from 'src/services';
import type { BoardType } from 'src/services';

const board: BoardType =
JSON.parse(localStorage.getItem('board') as string) || getDefaultBoard();
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-trello/src/views/Board.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue';
import HelloWorld from 'src/components/HelloWorld.vue';
</script>

<template>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-trello/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"paths": {
"@/*": ["src/*"]
},
"baseUrl": ".",
"lib": ["esnext", "dom"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
Expand Down
9 changes: 7 additions & 2 deletions packages/vue-trello/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
base:
process.env.NODE_ENV === 'production' ? '/awesome-web/vue-trello/' : '/',
base: '/awesome-web/vue-trello/',
plugins: [vue()],
resolve: {
alias: {
src: path.resolve(__dirname, './src'),
},
},
});

0 comments on commit 96de3ea

Please sign in to comment.