Does the current roadhog have a way to configure less-loader, in order to define globalVars

when the project component folder level is relatively deep, when the less file introduces the global less variable configuration file, you need to define a long relative path. For example, ".. / styles/variables" not only needs to calculate the level, but also needs to make changes accordingly when the file location is changed.

if you can define a global globalVar, such as @ src: "current webpack project directory" by configuring less-loader. Then import the less file @ {src} / styles/variables like this when referencing, and the coding will be more comfortable.

are there any current plans?

Apr.09,2021

The general idea of

is to extend the webpack configuration of roadhog by adding a webpack.config.js to the project directory. Add a .less file suffix to the extensions configured by resolve so that it can handle references to .less files.
by default, less-loader does not use webpack resolver for file parsing when the paths configuration is given. Therefore, the alias configuration is not valid in this case.

actual solution:
in roadhog configuration .webpackrc.js:

alias: {
    '@': path.resolve('./src'),
    assets: path.resolve('./public/assets/'),
},

in webpack.config.js:

module.exports = function(webpackConfig, env) {
  webpackConfig.resolve.extensions.push('.less');

  return webpackConfig;
};

.less file anywhere in the project:

// ./src/styles/vars.less
@import '~@/styles/vars';
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37956-2c0b1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37956-2c0b1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?