penpot/frontend/vite.config.js
Andrey Antukh 05ea09f2ba ♻️ Make vite configs compatible with the native config loader
Replace __dirname with import.meta.dirname in the plugins workspace
vite configs (root paths and the plugins-runtime tsconfigPath) and in
frontend/vite.config.js, dropping the fileURLToPath fallback.

Import vite.config.iife with the explicit .ts extension in the
plugin-api-test-suite headless/tests configs and allow it in
tsconfig.node.json (moduleResolution Bundler + noEmit), matching the
mcp/packages/plugin precedent.

Remove .storybook/vitest.setup.ts and its setupFiles entry;
@storybook/addon-vitest 10.3+ provisions preview annotations
automatically.

These clear the Vite `configLoader: 'native'` warnings ahead of that
loader becoming the default.

AI-assisted-by: omen-alpha
2026-09-09 08:04:11 +02:00

55 lines
1.6 KiB
JavaScript

/// <reference types="vitest/config" />
import { defineConfig } from "vite";
import { configDefaults } from "vitest/config";
import { resolve } from "path";
import { playwright } from '@vitest/browser-playwright'
// https://vitejs.dev/config/
import path from "node:path";
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
const dirname = import.meta.dirname;
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
export default defineConfig({
test: {
exclude: [...configDefaults.exclude, "target/**", "resources/**"],
environment: "jsdom",
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({
launchOptions: {
slowMo: 100,
timeout: 160000,
},
actionTimeout: 5000,
}),
instances: [
{browser: "chromium"},
],
},
},
},
],
},
resolve: {
alias: {
"@target": resolve(dirname, "./target/storybook"),
"@public": resolve(dirname, "./resources/public/js/"),
},
},
});