DEV Community

BekmuhammadDev
BekmuhammadDev

Posted on

4

Viteconfig / jsconfig

Vite.config.js

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from "node:url";


export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: [

      {
        find: "@",
        replacement: fileURLToPath(new URL('./src', import.meta.url)),
      },
      {
        find: "@components",
        replacement: fileURLToPath(new URL('./src/components', import.meta.url)),
      },
      {
        find: "@layouts",
        replacement: fileURLToPath(new URL('./src/components/layouts', import.meta.url)),

      },
      {
        find: "@layout",
        replacement: fileURLToPath(new URL('./src/layouts', import.meta.url)),

      },
      {
        find: "@mocks",
        replacement: fileURLToPath(new URL('./src/mocks', import.meta.url)),

      },
      {
        find: "@pages",
        replacement: fileURLToPath(new URL('./src/pages', import.meta.url)),

      },
      {
        find: "@router",
        replacement: fileURLToPath(new URL('./src/router', import.meta.url)),

      },
      {
        find: "@service",
        replacement: fileURLToPath(new URL('./src/service', import.meta.url)),

      },
      {
        find: "@utils",
        replacement: fileURLToPath(new URL('./src/utils', import.meta.url)),

      },
      {
        find: "@reducer",
        replacement: fileURLToPath(new URL('./src/reducer', import.meta.url)),

      },
    ],
  },
});
Enter fullscreen mode Exit fullscreen mode

jsconfig.json

{
    "compilerOptions": {
        "paths": {
            "@/*": ["./src/*"],
            "@components/*": ["./src/components/*"],
            "@ui/*": ["./src/components/ui/*"],
            "@layouts/*": ["./src/components/layouts/*"],
            "@form/*":["./src/components/form/*"],
            "@images/*": ["./src/assets/images/*"],
            "@icons/*": ["./src/assets/icons/*"],
            "@mocks/*": ["./src/mocks/*"],
            "@utils/*": ["./src/utils/*"],
            "@layout/*": ["./src/layouts/*"],
            "@pages/*": ["./src/pages/*"],
            "@router/*": ["./src/router/*"],
            "@service/*": ["./src/service/*"],
            "@reducer/*": ["./src/components/reducer/*"],



        }
    }
}

Enter fullscreen mode Exit fullscreen mode

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay