-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 working webpackResolveAlias with next.js #232
Comments
@yuki153 Thanks for reporting the issue! happy-css-modules resolves happy-css-modules/packages/happy-css-modules/src/resolver/webpack-resolver.ts Lines 92 to 97 in 1c05ec8
happy-css-modules/packages/happy-css-modules/src/resolver/webpack-resolver.test.ts Lines 24 to 32 in bf035f3
I think the problem will be solved if happy-css-modules mimics the resolve mechanism of existing tools to avoid compatibility issues. So I think we need to investigate the precedence order of the resolve mechanism in css-loader, scss-loader, and less-loader. |
As a workaround, you can use Also, you should use // test2.module.scss
@use "@/styles/shared.module.scss" as shared;
.headline {
font-size: 24px;
color: shared.$accentColor3;
} {
// ...
"scripts": {
// ...
"hcm": "hcm 'src/**/*.module.scss' --webpackResolveAlias='{\"@\": \"src\"}'"
},
// ...
} |
Hello, thank you for the great tool.
I had a question about this tool and created this issue.
Link to the code that reproduces this issue
https://github.com/yuki153/test-hcm-with-nextjs
To Reproduce
※ The code for reproduction uses next.js v14.0.4(latest) but, other version (e.g. v12.0.4) also reproduces.
Problem description
Path resolution of next.js succeed, but happy-css-module only fail to resolve path.
Below code that uses alias path at
@use
fail to path resolve, so d.ts file also doesn't make. But commented out code that does not use alias succeed to make d.ts file.Value of webpackResolveAlias is
{"~": "../../src"}
. Am I mistaken about how to use this alias option?Error log
The text was updated successfully, but these errors were encountered: