From 81553df7cbd02f3eea8fb0f68ba2cefb2eac5f1f Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 21 Apr 2019 13:30:48 -0400 Subject: [PATCH] apply fix from 01c0097acb7e8ae5b4c3852df17612381311ba7d (#622) --- src/core/create_compilers/WebpackResult.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/core/create_compilers/WebpackResult.ts b/src/core/create_compilers/WebpackResult.ts index c014f11..1e25efd 100644 --- a/src/core/create_compilers/WebpackResult.ts +++ b/src/core/create_compilers/WebpackResult.ts @@ -1,6 +1,6 @@ import format_messages from 'webpack-format-messages'; import { CompileResult, BuildInfo, CompileError, Chunk, CssFile } from './interfaces'; -import { ManifestData, Dirs } from '../../interfaces'; +import { ManifestData, Dirs, PageComponent } from '../../interfaces'; const locPattern = /\((\d+):(\d+)\)$/; @@ -9,7 +9,7 @@ function munge_warning_or_error(message: string) { const lines = message.split('\n'); const file = lines.shift() - .replace('', '') // careful — there is a special character at the beginning of this string + .replace('', '') // careful — there is a special character at the beginning of this string .replace('', '') .replace('./', ''); @@ -66,12 +66,15 @@ export default class WebpackResult implements CompileResult { assets: this.assets, css: { main: extract_css(this.assets.main), - chunks: Object - .keys(this.assets) - .filter(chunkName => chunkName !== 'main') - .reduce((chunks: { [key: string]: string }, chukName) => { - const assets = this.assets[chukName]; - chunks[chukName] = extract_css(assets); + chunks: manifest_data.components + .reduce((chunks: Record, component: PageComponent) => { + const css_dependencies = []; + const css = extract_css(this.assets[component.name]); + + if (css) css_dependencies.push(css); + + chunks[component.file] = css_dependencies; + return chunks; }, {}) }