61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import path from 'node:path';
|
|
// https://vite.dev/config/
|
|
import { fileURLToPath } from 'node:url';
|
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
import { playwright } from '@vitest/browser-playwright';
|
|
import { defineConfig } from 'vite';
|
|
import svgr from 'vite-plugin-svgr';
|
|
|
|
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
export default defineConfig({
|
|
base: '/app/',
|
|
plugins: [tanstackRouter({
|
|
target: 'react',
|
|
autoCodeSplitting: true,
|
|
}), react(), tailwindcss(), svgr()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/app/api': 'http://10.0.0.10:8000',
|
|
},
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
allowedHosts: ['nix.org.cn', 'nixos.party'],
|
|
},
|
|
test: {
|
|
projects: [{
|
|
extends: true,
|
|
plugins: [
|
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
storybookTest({
|
|
configDir: path.join(dirname, '.storybook'),
|
|
}),
|
|
],
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: playwright({}),
|
|
instances: [{
|
|
browser: 'chromium',
|
|
}],
|
|
},
|
|
setupFiles: ['.storybook/vitest.setup.ts'],
|
|
},
|
|
}],
|
|
},
|
|
});
|