Object | Function
{}
The config of style-loader can be set through tools.styleLoader
.
It is worth noting that Rsbuild does not enable style-loader
by default. You can use output.injectStyles config to enable it.
When tools.styleLoader
is an object, it will be merged with the default configuration using Object.assign
.
export default {
tools: {
styleLoader: {
insert: 'head',
},
},
};
When tools.styleLoader
is a function, the default options will be passed in as the first parameter. You can directly modify this object or return a new object as the final options to be used. For example:
export default {
tools: {
styleLoader: (config) => {
config.insert = 'head';
return config;
},
},
};