-
-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
I have to have a config file at the root and in my monorepo's package's directory. Just for context, I use absolute import paths in my projects, and no one so far has suggested needing the appName/vite.config.mts file, so I'm really confused why it works lol:
- apps
- appName
- vite.config.mts
- vite.config.mts
The root config file:
import { defineConfig } from "vitest/config"
import tsconfigPaths from "vite-tsconfig-paths"
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
projects: ["packages/*", "apps/*", "lib/typescript/*"],
},
})The appName/vite.config.mts
import { defineConfig } from "vitest/config"
import tsconfigPaths from "vite-tsconfig-paths"
export default defineConfig({
plugins: [tsconfigPaths()],
})My tsconfig.json file:
{
"compilerOptions": {
"lib": ["esnext", "dom", "dom.iterable"],
"allowJs": false,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "ESNext",
"target": "ESNext",
"allowImportingTsExtensions": false,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"composite": true,
"paths": {
"@scraper/*": ["./src/*"],
"@lib/dao/*": ["../../lib/typescript/dao/src/*"]
},
"rootDir": "./src",
"outDir": "./build"
},
"include": ["**/*.ts"],
"exclude": ["node_modules"],
"references": [{ "path": "../../lib/typescript/dao" }]
}
Removing the appName/vite.config.mts file fails the test suite
Also fwiw, if others stumble upon a need to set up a monorepo and want to shove things into a .config dir, this is my real .config/vitest.config.mts file:
import { resolve } from "node:path"
import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vitest/config"
export default defineConfig({
plugins: [
tsconfigPaths({
root: resolve(__dirname, ".."),
}),
],
test: {
projects: ["packages/*", "apps/*", "lib/typescript/*"],
},
root: resolve(__dirname, ".."),
})Metadata
Metadata
Assignees
Labels
No labels