Skip to content

Can't use package.json property imports to import subpath module. #3715

Open
@YourWildDad

Description

@YourWildDad

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions