-
Notifications
You must be signed in to change notification settings - Fork 71
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
Not work with less and webpack when I choose webpack resolvers in less-loader #77
Comments
Hi @dancon, thanks for reporting this. Can you please provide a small reproduction? I will then take a look and try to resolve this by the end of the weekend! |
@mrmckeb I'm so sorry for replying late, here is the reproduction repo, thank you for your greate job ! |
@mrmckeb Yes, I know why it doesn't work, and I'd love to fix it, but maybe by this weekend. |
@mrmckeb Hi, I'm trying to add the feature support by writing a less plugin, please note that ~ |
+1, this feature would be also awesome in sass/scss. I use CRA with @import "~styles/variables" // assuming, that there is a file "src/styles/_variables.scss" By the way, thanks for this great package, it really makes me not pull out hairs from my head while working. It would be nice to see this kind of feature implemented in Typescript by default in the future. |
I'll release this today, thanks! |
This has been released, sorry for the long delay. Please see: https://github.com/mrmckeb/typescript-plugin-css-modules/releases/tag/v2.3.0 |
----------- Update 2020-03-16 -----------
I have fixed the issue by writing a
less-plugin-aliases
that work withtypescript-plugin-css-modules
customRenderer
, you just modify the config as below:You can use the
less-plugin-aliases
now, it works well in my project.The plugin will read the
tsconfig.json
default to get the compilerOptions to resolve the@import ~xx
case, and I also commit a PR that inject the compilerOptions intocustomRenderer
from ts plugin (I think this way is more elegant and power more to customRenderer ), after that the less plugin will not readtsconfig.json
anymore.Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
As less-loader says, I can choose webpack resovler by prepending my
@import
path with~
, then the plugin does not work as expected.Describe the solution you'd like
A clear and concise description of what you want to happen.
In less file:
In tsconfig.json
In webpack.config file I also defined resolver.alias
Maybe when the plugin detect a @import path start begin
~
, deal it withpaths
defined in tsconfig.jsonDescribe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Now, I just use relative path to make it work, but it's ugly and nonportable.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: