mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(build): omit module ids from component metadata. (#984)
> 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.
This commit is contained in:
committed by
Jeremy Elbourn
parent
6e99d907a7
commit
7f594ce206
@@ -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, '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user