Open Meemaw opened 1 year ago
Hi. I'm trying to use vite-plugin-relay on a project that uses src as the root, and uses tsconfig paths for absolute imports.
vite-plugin-relay
src
import react from "@vitejs/plugin-react" import tsconfigPaths from "vite-tsconfig-paths" import { defineConfig } from "vitest/config" import relay from "vite-plugin-relay" // https://vitejs.dev/config/ export default defineConfig({ plugins: [react(), tsconfigPaths(), relay], test: { globals: true, environment: "jsdom", setupFiles: ["./__tests__/setupVitestTests.ts"] }, root: "src", })
module.exports = { src: "./src", schema: "./schema.graphql", schemaExtensions: ["./src"], exclude: [ "**/__generated__/**", "**/__mocks__/**", "**/node_modules/**", "src/.next/**", ], language: "typescript", eagerEsModules: true, artifactDirectory: "./src/lib/graphql/__generated__", }
"paths": { "@/*": ["./*"] }
import { CollectionWatchlistButtonTestQuery } from "@/lib/graphql/__generated__/CollectionWatchlistButtonTestQuery.graphql"
When trying to run tests, vitest fails to find generated modules:
Any solution? Same here
Hi. I'm trying to use
vite-plugin-relay
on a project that usessrc
as the root, and uses tsconfig paths for absolute imports.vitest.config.ts
relay.config.js
tsconfig paths:
Imports:
When trying to run tests, vitest fails to find generated modules: