Skip to content

How to use with less global variables #53

Closed
@woshiguabi

Description

@woshiguabi

Describe the bug
In my project, i use less-loader option modifyVars to support global variables.
But seems like modifyVars will cause plugin not working.

To Reproduce
path/to/webpack.config.js

{
  loader: 'less-loader',
  options: {
    modifyVars: require("path/to/theme.js")
  }
}

path/to/theme.js

{
  'global-variable': '#666'
}

path/to/component.less

.component {
  color: @global-variable;
}

path/to/component.tsx

import styles from 'path/to/component.less'; // empty object 

Expected behavior
The export object includes component prop.

Desktop (please complete the following information):

  • OS: Win10
  • Browser Chrome
  • Version latest

Additional context
I know this plugin can't get less-loader global variables, so is there any solution for this issue?
Add an option to import the global variables may be a quick fix.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions