less/less.js
View on GitHubCan't use package.json property `imports` to import subpath module.
Open
#3715 opened on Apr 20, 2022
bugfeature requestgood first issueup-for-grabs
Description
My package.json :
{
...,
"imports": {
"#style/*": "./src/style/*"
}
...
}
when i use less-loader to load less file like:
@import (refrence) "#style/mixins"
i got error like:
'#style/mixins' wasn't found. Tried - .less
Error in D:\Development\xxx\index.module.less (line 2, column 0)
I think less throws an error before using the FileManager to resolve the file, making it impossible to use the webpack resolver to resolve the real path.
When I change the code to the following, everything works fine:
@import (refrence) "~#style/mixins"
My packages version is:
- less@4.1.2
- less-loader@10.2.0
- webpack@5.68.0
- enhanced-resolve@5.9.2