137 lines
4.8 KiB
TypeScript
137 lines
4.8 KiB
TypeScript
import inertia from '@inertiajs/vite';
|
|
import { wayfinder } from '@laravel/vite-plugin-wayfinder';
|
|
import babel from '@rolldown/plugin-babel';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
|
|
import laravel from 'laravel-vite-plugin';
|
|
import { bunny } from 'laravel-vite-plugin/fonts';
|
|
import { defineConfig, lazyPlugins } from 'vite-plus';
|
|
|
|
const qaBuild = process.env.INVESTMOZ_QA_BUILD === '1';
|
|
|
|
export default defineConfig(({ command }) => ({
|
|
// Label the isolated QA browser without changing the active environment/build.
|
|
define: qaBuild
|
|
? { 'import.meta.env.VITE_APP_NAME': JSON.stringify('InvesteMoz QA') }
|
|
: undefined,
|
|
plugins: lazyPlugins(() => [
|
|
laravel({
|
|
buildDirectory: qaBuild ? 'build-qa-opportunities' : 'build',
|
|
input: ['resources/css/app.css', 'resources/js/app.tsx'],
|
|
refresh: true,
|
|
fonts: [
|
|
bunny('Instrument Sans', {
|
|
weights: [400, 500, 600],
|
|
}),
|
|
...(qaBuild
|
|
? [
|
|
bunny('Noto Sans', { weights: [400, 500, 600, 700] }),
|
|
bunny('Noto Serif', { weights: [400, 600, 700] }),
|
|
]
|
|
: []),
|
|
],
|
|
}),
|
|
inertia(),
|
|
react(),
|
|
babel({
|
|
// Compile React components and hooks, not generated URLs or data utilities.
|
|
include: [/\.[jt]sx(?:$|\?)/, /[/\\]hooks[/\\].*\.[jt]s(?:$|\?)/],
|
|
presets: [reactCompilerPreset()],
|
|
// Keep development debugging; production does not emit source maps.
|
|
sourceMap: command !== 'build',
|
|
}),
|
|
tailwindcss(),
|
|
// Reuse generated URLs in QA without booting the active Laravel environment.
|
|
...(!qaBuild ? [wayfinder({ formVariants: true })] : []),
|
|
]),
|
|
build: {
|
|
rolldownOptions: {
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{
|
|
name: 'document-word',
|
|
test: /[/\\]node_modules[/\\]docx[/\\]/,
|
|
},
|
|
{
|
|
name: 'document-zip',
|
|
test: /[/\\]node_modules[/\\]jszip[/\\]/,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
// Laravel's public/hot points to IPv4 loopback; bind Vite there explicitly.
|
|
host: '127.0.0.1',
|
|
watch: {
|
|
ignored: [
|
|
'**/.agents/**',
|
|
'**/.claude/**',
|
|
'**/.cursor/**',
|
|
'**/.junie/**',
|
|
'**/vendor/**',
|
|
],
|
|
},
|
|
},
|
|
lint: {
|
|
ignorePatterns: [
|
|
// Historical QA evidence is retained byte-for-byte outside the application lint scope.
|
|
'tools/**',
|
|
'outputs/**',
|
|
'tests/frontend/fixtures/**',
|
|
'vendor/**',
|
|
'node_modules/**',
|
|
'public/**',
|
|
'bootstrap/ssr/**',
|
|
'tailwind.config.js',
|
|
'resources/js/actions/**',
|
|
'resources/js/components/ui/*',
|
|
'resources/js/routes/**',
|
|
'resources/js/wayfinder/**',
|
|
// Original unmounted prototype; the maintained page is resources/js/pages/PortalInvestidor.tsx.
|
|
'resources/views/PortalInvestidor.jsx',
|
|
],
|
|
options: {
|
|
denyWarnings: true,
|
|
typeAware: true,
|
|
},
|
|
},
|
|
fmt: {
|
|
printWidth: 80,
|
|
tabWidth: 4,
|
|
singleQuote: true,
|
|
semi: true,
|
|
singleAttributePerLine: false,
|
|
htmlWhitespaceSensitivity: 'css',
|
|
ignorePatterns: [
|
|
'AGENTS.md',
|
|
'.github/**',
|
|
'docs/**',
|
|
'tools/**',
|
|
'outputs/**',
|
|
'database/data/**',
|
|
'tests/frontend/fixtures/**',
|
|
'config/*.json',
|
|
'composer.json',
|
|
'resources/js/components/ui/*',
|
|
'resources/views/mail/*',
|
|
'resources/views/PortalInvestidor.jsx',
|
|
// Generated/hashed schema evidence must retain its generator's formatting.
|
|
'docs/investmoz/*.json',
|
|
// Preserve source bytes and versioned evidence; these are not authored UI files.
|
|
'docs/investmoz/simulations/source-archive/**',
|
|
'docs/investmoz/README.md',
|
|
'docs/investmoz/architecture-and-migrations.md',
|
|
'docs/investmoz/decisions.md',
|
|
'docs/investmoz/runbook.md',
|
|
'docs/investmoz/validation.md',
|
|
],
|
|
sortTailwindcss: {
|
|
functions: ['clsx', 'cn', 'cva'],
|
|
entryPoint: 'resources/css/app.css',
|
|
},
|
|
},
|
|
}));
|