|
1 | 1 | import { fileURLToPath } from 'node:url' |
| 2 | +import { resolve, dirname } from 'node:path' |
2 | 3 | import { defineConfig } from 'vitepress' |
3 | 4 | import { useSidebar } from 'vitepress-openapi' |
4 | 5 | import { testsPages } from '../../../../../docs/pages' |
5 | 6 | import spec from '../../../../../docs/public/openapi.json' |
6 | 7 |
|
| 8 | +const __filename = fileURLToPath(import.meta.url) |
| 9 | +const __dirname = dirname(__filename) |
| 10 | +const rootDir = resolve(__dirname, '../../../../../') |
| 11 | + |
7 | 12 | const sidebar = useSidebar({ |
8 | 13 | spec, |
9 | 14 | // Optionally, you can specify a link prefix for all generated sidebar items. |
@@ -71,13 +76,14 @@ export default defineConfig({ |
71 | 76 | vite: { |
72 | 77 | resolve: { |
73 | 78 | alias: { |
| 79 | + '@': resolve(rootDir, 'src'), |
| 80 | + '@public': fileURLToPath(new URL('../../../../../docs/public', import.meta.url)), |
74 | 81 | ...(process.env.NODE_ENV === 'production' |
75 | 82 | ? {} |
76 | 83 | : { |
77 | 84 | 'vitepress-openapi/client': fileURLToPath(new URL('../../../../../src/client', import.meta.url)), |
78 | 85 | 'vitepress-openapi/dist/style.css': fileURLToPath(new URL('../../../../../dist/vitepress-openapi.css', import.meta.url)), |
79 | 86 | 'vitepress-openapi': fileURLToPath(new URL('../../../../../src/index', import.meta.url)), |
80 | | - '@public': fileURLToPath(new URL('../../../../../docs/public', import.meta.url)), |
81 | 87 | }), |
82 | 88 | }, |
83 | 89 | }, |
|
0 commit comments