$ npm install --save-dev alias-resolve-loader@1.0.6
$ npm install --save-dev alias-resolve-loader
module.exports = {
//...
module: {
preLoaders: [
{
test: /\.(less|scss|css)$/,
loader: "alias-resolve-loader"
}
]
},
aliasesResolve: {
"@aliasName": "path/to/your/folder"
},
//...
};
module.exports = {
//...
module: {
rules: [
{
enforce: 'pre',
test: /\.(less|scss|css)$/,
use: {
loader: 'alias-resolve-loader',
options: {
alias: {
"@aliasName": "path/to/your/folder"
}
}
},
}
]
},
//...
};
A javascript file before compilation
@import "@aliasName/css/user.less";
body {
background: #9e9e9e;
}
will become:
@import "path/to/your/folder/css/user.less";
body {
background: #9e9e9e;
}