@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
35 lines • 1.23 kB
JavaScript
// src/helpers/webpack.ts
function nextCamelCaseCSSModulesTransform(config) {
var _a, _b;
const rules = (_a = config.module) == null ? void 0 : _a.rules;
if (!((_b = config.module) == null ? void 0 : _b.rules) || !Array.isArray(rules)) return config;
config.module.rules = rules.map((rule) => {
if (!rule || typeof rule !== "object") {
return rule;
}
if (!rule.oneOf) {
return rule;
}
rule.oneOf = rule.oneOf.map((option) => {
if (option && option.test instanceof RegExp && option.test.test("my.module.css") && Array.isArray(option.use)) {
option.use = option.use.map((loader) => {
var _a2;
if (loader && typeof loader === "object" && ((_a2 = loader == null ? void 0 : loader.loader) == null ? void 0 : _a2.includes("/css-loader")) && typeof loader.options === "object") {
if (!loader.options.modules) {
loader.options.modules = {};
}
loader.options.modules.exportLocalsConvention = "camelCase";
}
return loader;
});
}
return option;
});
return rule;
});
return config;
}
export {
nextCamelCaseCSSModulesTransform
};
//# sourceMappingURL=webpack.mjs.map