Skip to content

Absolute paths using baseUrl in CRA-based project won't get resolved correctly #24

Closed
@ChristianIvicevic

Description

@ChristianIvicevic

Describe the bug
I am writing a CRA-based application and just turned on "baseUrl": "src" in the corresponding tsconfig.json file. Hence I am importing styles as import Styles from "components/App/App.module.scss"; instead of import Styles from "./App.module.scss"; for example. This causes the plugin to not do anything and not suggest any class names since it cannot resolve the file apparently due to the unexpected nature of the absolute paths.

To Reproduce
Steps to reproduce the behavior:

  1. Create a fresh CRA 3.0+ application.
  2. Add "baseUrl": "src" to the compilerOptions of tsconfig.json.
  3. Install node-sass.
  4. Rename the file App.css to App.module.scss.
  5. Import as import Styles from "App.module.scss";.
  6. Notice how you get no code completion since the plugin isn't able to pick up the file.

Expected behavior
No squigglies when attempting to access Styles["App"] or Styles["App-header"] and proper dynamic typing of Styles.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions