1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 10:32:31 +01:00
Pterodactyl-Panel/vite.config.ts

63 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-11-25 21:25:03 +01:00
/// <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}'],
},
});