From d9ae7ce6dc12b13bcde0dcd4b056d104cc196962 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 10 Aug 2016 15:42:05 +0200 Subject: [PATCH] fix(inline-resources): remove module ids from component metadata. > Removes the module ids of the component metadata. > Since the templates and styles are now inlined, the module id has become unnecessary and > can cause unexpected issues This also fixes https://github.com/angular/material2/issues/974 in meanwhile. --- scripts/release/inline-resources.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/release/inline-resources.js b/scripts/release/inline-resources.js index 697612ffb47a..42cfd23f8ca1 100644 --- a/scripts/release/inline-resources.js +++ b/scripts/release/inline-resources.js @@ -46,6 +46,7 @@ for (let arg of process.argv.slice(2)) { readFile(filePath, 'utf-8') .then(content => inlineTemplate(filePath, content)) .then(content => inlineStyle(filePath, content)) + .then(content => removeModuleIds(content)) .then(content => writeFile(filePath, content)) .catch(err => { console.error('An error occured: ', err); @@ -96,3 +97,13 @@ function inlineStyle(filePath, content) { + ']'; }); } + +/** + * Removes the module ids of the component metadata. + * Since the templates and styles are now inlined, the module id has become unnecessary and + * can cause unexpected issues. + */ +function removeModuleIds(content) { + // Match the line feeds as well, because we want to get rid of that line. + return content.replace(/^\W+moduleId:\W+module\.id,?[\n|\r]+/gm, ''); +}