UNPKG

plugin-light

Version:

Webpack 相关插件、Loader、基础配置及 CLI 命令

20 lines (16 loc) 485 B
'use strict'; var loaderUtils = require('loader-utils'); String.prototype.replaceAll = function (s1, s2) { return this.replace(new RegExp(s1, 'gm'), s2); }; function crossModuleStyle(source) { var options = loaderUtils.getOptions(this) || {}; if (!options.target) { return source; } if (source.indexOf('@TIP_MODULE_STYLE_NAME') !== -1) { return source.replaceAll('@TIP_MODULE_STYLE_NAME', options.target); } return source; } module.exports = crossModuleStyle;