built-asset --> built-assets

This commit is contained in:
RMidhunSuresh 2022-05-12 14:31:28 +05:30
parent e63440527a
commit 4ddfd3b508
2 changed files with 5 additions and 5 deletions

View file

@ -253,17 +253,17 @@ module.exports = function buildThemes(options) {
const compiledVariables = options.compiledVariables.get(location);
const derivedVariables = compiledVariables["derived-variables"];
const icon = compiledVariables["icon"];
const builtAsset = {};
const builtAssets = {};
/**
* Generate a mapping from theme name to asset hashed location of said theme in build output.
* This can be used to enumerate themes during runtime.
*/
for (const chunk of chunkArray) {
const [, name, variant] = chunk.fileName.match(/theme-(.+)-(.+)\.css/);
builtAsset[`${name}-${variant}`] = assetMap.get(chunk.fileName).fileName;
builtAssets[`${name}-${variant}`] = assetMap.get(chunk.fileName).fileName;
}
manifest.source = {
"built-asset": builtAsset,
"built-assets": builtAssets,
"runtime-asset": assetMap.get(runtimeThemeChunk.fileName).fileName,
"derived-variables": derivedVariables,
"icon": icon

View file

@ -37,10 +37,10 @@ export class ThemeLoader {
.response();
/*
After build has finished, the source section of each theme manifest
contains `built-asset` which is a mapping from the theme-name to the
contains `built-assets` which is a mapping from the theme-name to the
location of the css file in build.
*/
Object.assign(this._themeMapping, body["source"]["built-asset"]);
Object.assign(this._themeMapping, body["source"]["built-assets"]);
}
}