Skip to content

not working with tsconfig paths aliases #53

@sveinnthorarins

Description

@sveinnthorarins

Hi,

I am having issues to get the plugin working with the compilerOptions.paths in tsconfig.json.

My tsconfig.json looks like this:

{
  "compilerOptions": {
    "strict": true,
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "jsx": "preserve",
    "jsxImportSource": "solid-js",
    "types": ["vite/client"],
    "baseUrl": ".",
    "paths": {
      "@/components/*": ["src/components/*"],
      "@/contexts/*": ["src/contexts/*"],
      "@/lib/*": ["src/lib/*"],
      "@/styles/*": ["src/styles/*"],
      "@/types/*": ["src/types/*"]
    }
  }
}

And I'm importing in some Component.tsx (located in src/components) like this:

import styles from '@/styles/Component.module.scss';

When doing this the plugin doesn't seem to work and I get no auto-complete for the styles variable.

However, it does work when I change the import to be relative like this:

import styles from '../styles/Component.module.scss';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions