Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin doesn't work with sass-loader v8 and above and less-loader v6 and above #82

Open
nad182 opened this issue Jul 28, 2020 · 2 comments

Comments

@nad182
Copy link

nad182 commented Jul 28, 2020

Spend hours trying to get the plugin to work. Seems like sass-loader and less-loader both changed their options object shapes. I got to the bottom of the issue by exploring antdSassLoader.js and antdLEssLoader.js.

  1. antdSassLoader.js (the error was something like options has an unknown property 'importer')
    The issue there is that there is no importer prop in options anymore, it's in sassOptions. So should be something like this:
newOptions.sassOptions = {}
newOptions.sassOptions.importer = importer
  1. antdLEssLoader.js (the error was something like options has an unknown property 'modifyVars')
    The issue here is that modifyVars was moved inside lessOptions prop and you also must pass javascriptEnabled: true (without is the error you're getting is (Inline JavaScript is not enabled. Is it set in your options?) to lessOptions like this:
  const newOptions = _extends({}, options, {
    lessOptions: {
      modifyVars: _extends({}, themeModifyVars, options.modifyVars || {}), 
      javascriptEnabled: true
    }
  });

Without those changes, you're getting a bunch of different errors.

Screenshots of "successful" configs are attached.

Screen Shot 2020-07-28 at 12 20 33 AM

Screen Shot 2020-07-28 at 12 19 57 AM

@kbouchard
Copy link

+1

@igor-lemon
Copy link

I made a PR but it looks like the author doesn't want to support
#119

As alternative you can use
https://github.com/igor-lemon/antd-scss-theme-plugin
or full completely craco solution
https://github.com/igor-lemon/craco-antd-scss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants