mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
Fixed %sapper.styles% injection for webpack builds
This commit is contained in:
committed by
GitHub
parent
7be7e1eb9f
commit
01c0097acb
@@ -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+)\)$/;
|
||||
|
||||
@@ -66,14 +66,17 @@ 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);
|
||||
return chunks;
|
||||
}, {})
|
||||
chunks: manifest_data.components
|
||||
.reduce((chunks: Record<string, string[]>, 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;
|
||||
}, {})
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -81,4 +84,4 @@ export default class WebpackResult implements CompileResult {
|
||||
print() {
|
||||
return this.stats.toString({ colors: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user