extend system loader with moduleName support

This commit is contained in:
Denys Vuika 2016-12-08 15:51:46 +00:00
parent dd20f6fc78
commit 62d7abcb72

View File

@ -1,15 +1,22 @@
const moduleIdRegex = /moduleId: module.id,/g; const moduleIdRegex = /moduleId: module.id,/g;
const moduleNameRegex = /moduleId: __moduleName,/g;
module.exports = function(source) { module.exports = function(source) {
this.cacheable(); this.cacheable();
let result = source; let result = source;
let modified = false;
if (moduleIdRegex.test(source)) { if (moduleIdRegex.test(source)) {
result = source.replace(moduleIdRegex, (match) => { result = source.replace(moduleIdRegex, (match) => {
return `// ${match}`; return `// ${match}`;
}); });
// console.log(result);
} }
if (moduleNameRegex.test(source)) {
result = source.replace(moduleNameRegex, (match) => {
return `// ${match}`;
});
}
return result; return result;
} }