-
Notifications
You must be signed in to change notification settings - Fork 74
Absolute paths using baseUrl in CRA-based project won't get resolved correctly #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @ChristianIvicevic, this should work as Also, you shouldn't need to install node-sass, CRA will compile Sass for you in newer versions :) Are you able to share your test repository? Otherwise I can take a look over the weekend. |
The documentation still explicitly states to install node-sass when using CSS modules with SCSS files. Never really heard it not being necessary. Anyways, I just upped a very simple repo for you to check what's going on: https://github.com/ChristianIvicevic/css-modules-mwe |
Sorry @ChristianIvicevic, you're correct - I never faced the issue as I always had Storybook installed. Thanks for your time helping to resolve this, it turned out to be a little trickier than expected... so do let me know if this does or doesn't solve your issue. I'll close this ticket when we're ready to release. |
@mrmckeb I'll test this later this evening or tomorrow and report on whether this fix has resolved the issue. Thanks for looking into it! |
I'm still having this issue. // foobar.module.scss
@import 'src/sass-helpers/functions' import styles from './foobar.module.scss' Does not raise a TS error the type of @import '../../sass-helpers/functions' |
For anyone that comes across this issue, you need to set this up in the plugin's settings. Example here: #113 (comment). |
Describe the bug
I am writing a CRA-based application and just turned on
"baseUrl": "src"
in the correspondingtsconfig.json
file. Hence I am importing styles asimport Styles from "components/App/App.module.scss";
instead ofimport 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:
"baseUrl": "src"
to thecompilerOptions
oftsconfig.json
.node-sass
.App.css
toApp.module.scss
.import Styles from "App.module.scss";
.Expected behavior
No squigglies when attempting to access
Styles["App"]
orStyles["App-header"]
and proper dynamic typing ofStyles
.The text was updated successfully, but these errors were encountered: