You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't use package.json property imports to import subpath module. #3715
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:
changed the title [-]Can't use package.json `imports` property to import subpath module.[/-][+]Can't use package.json property `imports` to import subpath module.[/+]on Apr 20, 2022
Hello , I found the bug and made the changes in local repository as well as when I ran the test , all test worked fine, My question is, how do I ensure that the error : #style/mixins' wasn't found , is resolved or not?
I’ve gone through the issue and the related discussion. I’d like to work on improving support for resolving subpath imports using the package.jsonimports field.
From what I understand, the main problem is that LESS tries to resolve the path before Webpack’s resolver or the FileManager handles it. My plan is to:
Investigate how the FileManager handles path resolution at file-manager.js#L62.
Add a check to allow subpath imports like #style/* to be resolved through Node’s imports map or Webpack resolver before throwing the “wasn’t found” error.
Test the fix with a package.json that includes a custom imports field to verify resolution works as expected.
Activity
[-]Can't use package.json `imports` property to import subpath module.[/-][+]Can't use package.json property `imports` to import subpath module.[/+]RUSHIM24 commentedon Apr 10, 2023
Hello , I am new to open source , I want to work on this issue can you please guide me on how I can get started?
matthew-dean commentedon Apr 10, 2023
@RUSHIM24 If you want to take a look, great! You'd probably want to look at tracing the code here: https://github.com/less/less.js/blob/master/packages/less/src/less-node/file-manager.js#L62
RUSHIM24 commentedon Apr 14, 2023
Hello , I found the bug and made the changes in local repository as well as when I ran the test , all test worked fine, My question is, how do I ensure that the error : #style/mixins' wasn't found , is resolved or not?
Cyddharth-Gupta commentedon Jul 10, 2023
@matthew-dean can I be assigned this issue?
MUNJETIJAYANTHKRISHNA commentedon Oct 20, 2025
I’ve gone through the issue and the related discussion. I’d like to work on improving support for resolving subpath imports using the
package.jsonimportsfield.From what I understand, the main problem is that LESS tries to resolve the path before Webpack’s resolver or the FileManager handles it. My plan is to:
FileManagerhandles path resolution at file-manager.js#L62.#style/*to be resolved through Node’simportsmap or Webpack resolver before throwing the “wasn’t found” error.package.jsonthat includes a customimportsfield to verify resolution works as expected.