Skip to content

Importing sass file from "node_modules" doesn't work. #66

@muj-beg

Description

@muj-beg

Describe the bug
If the CSS module I'm importing in turn imports another SASS file using the "~" prefix, the plugin can't resolve the imported file.

To Reproduce
File: styles.module.scss:

  @import "~@blueprintjs/core/lib/scss/variables";
    ... other local style declarations

Expected behavior
Importing SASS files from the node_modules folder using the ~ syntax should work.

Actual Behavior
The following error shows up in TS server log:

1 │ @import "~@blueprintjs/core/lib/scss/variables";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  stdin 1:9  root stylesheet
Info 526  [11:17:32.779] [typescript-plugin-css-modules] Stack trace: Error: Can't find stylesheet to import.
  ╷
1 │ @import "~@blueprintjs/core/lib/scss/variables";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  stdin 1:9  root stylesheet
    at Object._newRenderError (\forms\node_modules\sass\sass.dart.js:10819:19)
    at Object._wrapException (\forms\node_modules\sass\sass.dart.js:10669:16)
    at StaticClosure._renderSync (\forms\node_modules\sass\sass.dart.js:10644:18)
    at Object.Primitives_applyFunction (\forms\node_modules\sass\sass.dart.js:1060:30)
    at Object.Function_apply (\forms\node_modules\sass\sass.dart.js:4885:16)
    at _callDartFunctionFast (\forms\node_modules\sass\sass.dart.js:6565:16)
    at Object.renderSync (\forms\node_modules\sass\sass.dart.js:6543:18)
    at Object.exports.getClasses (\forms\node_modules\typescript-plugin-css-modules\lib\helpers\getClasses.js:68:18)```

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions