antd-scss-theme-plugin
antd-scss-theme-plugin copied to clipboard
Plugin doesn't work with sass-loader v8 and above and less-loader v6 and above
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.
antdSassLoader.js(the error was something likeoptions has an unknown property 'importer') The issue there is that there is noimporterprop in options anymore, it's insassOptions. So should be something like this:
newOptions.sassOptions = {}
newOptions.sassOptions.importer = importer
antdLEssLoader.js(the error was something likeoptions has an unknown property 'modifyVars') The issue here is thatmodifyVarswas moved insidelessOptionsprop and you also must passjavascriptEnabled: true(without is the error you're getting is (Inline JavaScript is not enabled. Is it set in your options?) tolessOptionslike 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.
+1
I made a PR but it looks like the author doesn't want to support https://github.com/intoli/antd-scss-theme-plugin/pull/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