Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular/cli): fix problem of SuppressPlugin in case entryFiles type is string #7393

Merged
merged 2 commits into from
Aug 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export class SuppressExtractedTextChunksWebpackPlugin {
compiler.plugin('compilation', function (compilation: any) {
// find which chunks have css only entry points
const cssOnlyChunks: string[] = [];
const entryPoints = compilation.options.entry;
// determine which entry points are composed entirely of css files
for (let entryPoint of Object.keys(entryPoints)) {
if (entryPoints[entryPoint].every((el: string) =>
el.match(/\.(css|scss|sass|less|styl)$/))) {
cssOnlyChunks.push(entryPoint);
}
const entryPoints = compilation.options.entry;
// determine which entry points are composed entirely of css files
for (let entryPoint of Object.keys(entryPoints)) {
let entryFiles: string[]|string = entryPoints[entryPoint];
// when type of entryFiles is not array, make it as an array
entryFiles = entryFiles instanceof Array ? entryFiles : [entryFiles];
if (entryFiles.every((el: string) =>
el.match(/\.(css|scss|sass|less|styl)$/) !== null)) {
cssOnlyChunks.push(entryPoint);
}
}
// Remove the js file for supressed chunks
compilation.plugin('after-seal', (callback: any) => {
compilation.chunks
Expand Down