Paths in git submodule not correctly resolved by parrent

Viewed 68

I have two Vue projects. The first project works as standalone application. The second one will require some Components from the first one.

I have created git submodule with the first app in order to provide the components to the second app, but my paths are not being correctly resolved.

I am using resolution from root with @ syntax (for example import { EdgeType } from '@/interfaces/sound')

It seems that the parent object tries to resolve the childs paths as if they belong to its root, not the childrens root. What can I do?

The configs are identical in both projects.

vite config:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vueAndTsChecker } from 'vite-plugin-typescript-vue-checker';

// https://vitejs.dev/config/
// eslint-disable-next-line
export default defineConfig({
  resolve: { alias: { '@': '/src' } },
  plugins: [vue(), vueAndTsChecker()],
});

tsconfig:

    {
      "compilerOptions": {
        "target": "esnext",
        "module": "esnext",
        "strict": true,
        "jsx": "preserve",
        "importHelpers": true,
        "moduleResolution": "node",
        "esModuleInterop": true,
        "resolveJsonModule": true,
        "allowSyntheticDefaultImports": true,
        "sourceMap": true,
        "baseUrl": ".",
        "types": ["cypress"],
        "paths": {
          "@/*": [
            "src/*"
          ]
        },
        "lib": [
          "esnext",
          "dom",
          "dom.iterable",
          "scripthost"
        ]
      },
      "include": [
        "src/**/*.ts",
        "src/**/*.tsx",
        "src/**/*.vue",
        "cypress/**/*.ts",
        "cypress/**/*.tsx"
      ],
      "exclude": [
        "node_modules"
      ]
    }
0 Answers
Related