Path alias not working

(Edit: i wrote 6 messages since discord didn't allow me.) import path alias is not working with the cf pages im using vite with react tho interesting part is i can get succesfully build with or without cloudflares vite plugin here is the error:
01:47:58.176 Executing user command: npm run build
01:47:58.640
01:47:58.640 > fluctur-dashboard@0.0.0 build
01:47:58.640 > tsc -b && vite build
01:47:58.640
01:48:02.030 src/components/ui/ThemeToggle.tsx(9,43): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.030 src/components/ui/shadcn/sonner.tsx(1,26): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.030 src/hooks/useApplyTheme.tsx(1,26): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.031 src/hooks/useApplyTheme.tsx(5,26): error TS7006: Parameter 'state' implicitly has an 'any' type.
01:48:02.320 Failed: Error while executing user command. Exited with error code: 2
01:48:02.328 Failed: build command exited with code: 1
01:48:03.422 Failed: error occurred while running build command
01:47:58.176 Executing user command: npm run build
01:47:58.640
01:47:58.640 > fluctur-dashboard@0.0.0 build
01:47:58.640 > tsc -b && vite build
01:47:58.640
01:48:02.030 src/components/ui/ThemeToggle.tsx(9,43): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.030 src/components/ui/shadcn/sonner.tsx(1,26): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.030 src/hooks/useApplyTheme.tsx(1,26): error TS2307: Cannot find module '@/store/themeStore' or its corresponding type declarations.
01:48:02.031 src/hooks/useApplyTheme.tsx(5,26): error TS7006: Parameter 'state' implicitly has an 'any' type.
01:48:02.320 Failed: Error while executing user command. Exited with error code: 2
01:48:02.328 Failed: build command exited with code: 1
01:48:03.422 Failed: error occurred while running build command
1 Reply
Honk!
Honk!OP5mo ago
it says type error but its not i can assure that also my tsconfig.node.json
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
tsconfig.json
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
tsconfig.app.json
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,

"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,

"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}
im using bun as package manager with node runtime current node version is : v22.16.0 and the vite config:
import tailwindcss from "@tailwindcss/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import react from "@vitejs/plugin-react-swc";
import path from "node:path";
import { defineConfig } from "vite";

// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
tanstackRouter({
target: "react",
// Flashing the page when navigating to a new route, but it's not a big deal since only happens on development
autoCodeSplitting: true,
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});
import tailwindcss from "@tailwindcss/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import react from "@vitejs/plugin-react-swc";
import path from "node:path";
import { defineConfig } from "vite";

// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
tanstackRouter({
target: "react",
// Flashing the page when navigating to a new route, but it's not a big deal since only happens on development
autoCodeSplitting: true,
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});
fixed the issue with a tsx to ts change somehow it was causing a problem no clue why

Did you find this page helpful?