62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
/// <reference types="vitest" />
|
|
import react from '@vitejs/plugin-react';
|
|
import laravel from 'laravel-vite-plugin';
|
|
import { dirname, resolve } from 'pathe';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig } from 'vite';
|
|
|
|
const plugins = [
|
|
react({
|
|
babel: {
|
|
plugins: ['babel-plugin-macros', 'babel-plugin-styled-components'],
|
|
},
|
|
}),
|
|
];
|
|
|
|
if (process.env.VITEST === undefined) {
|
|
plugins.push(
|
|
laravel({
|
|
input: 'resources/scripts/index.tsx',
|
|
}),
|
|
);
|
|
}
|
|
|
|
export default defineConfig({
|
|
define:
|
|
process.env.VITEST === undefined
|
|
? {
|
|
'process.env': {},
|
|
'process.platform': null,
|
|
'process.version': null,
|
|
'process.versions': null,
|
|
}
|
|
: undefined,
|
|
|
|
plugins,
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'resources', 'scripts'),
|
|
'@definitions': resolve(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
'resources',
|
|
'scripts',
|
|
'api',
|
|
'definitions',
|
|
),
|
|
'@feature': resolve(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
'resources',
|
|
'scripts',
|
|
'components',
|
|
'server',
|
|
'features',
|
|
),
|
|
},
|
|
},
|
|
|
|
test: {
|
|
environment: 'happy-dom',
|
|
include: ['resources/scripts/**/*.{spec,test}.{ts,tsx}'],
|
|
},
|
|
});
|