Skip to content

modifyVars not being passed on #3179

Closed
Closed
@briandipalma

Description

@briandipalma

I have an index.less file that decides what variables file to load in by a variable like so:

@theme-variant: "a-theme.less";

@import "./@{theme-variant}";

I have less files that load in that index file:

@import "~theme-variant-variables";

I am setting a value for the variable in my webpack.config.js file:

lessOptions.modifyVars = {
   "theme-variant": `"${v}-theme.less"`
}

If I move the contents of the index.less file into a directly imported less file everything works as I expect, I can switch the variables file chosen based on the webpack config logic, sadly if I try and centralize those two lines of less into a file that the directly imported less files import themselves it stops working. I see less loader calls less with the expected config so I'm guessing the less compiler doesn't propagate variables/options to imported less files. Is that expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions