Skip to content

Commit dd5647e

Browse files
committed
refactor: change entryPoints and CacheGroups variable definition.
1 parent b214ce5 commit dd5647e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

config/data/paragonUtils.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,18 @@ function getParagonThemeCss(dir, { isBrandOverride = false } = {}) {
108108
* @returns {Object.<string, CacheGroup>} The cache groups for the Paragon theme CSS.
109109
*/
110110
function getParagonCacheGroups(paragonThemeCss) {
111-
const cacheGroups = {};
112111
if (!paragonThemeCss) {
113-
return cacheGroups;
112+
return {};
114113
}
115-
cacheGroups[paragonThemeCss.core.outputChunkName] = {
116-
type: 'css/mini-extract',
117-
name: paragonThemeCss.core.outputChunkName,
118-
chunks: chunk => chunk.name === paragonThemeCss.core.entryName,
119-
enforce: true,
114+
const cacheGroups = {
115+
[paragonThemeCss.core.outputChunkName]: {
116+
type: 'css/mini-extract',
117+
name: paragonThemeCss.core.outputChunkName,
118+
chunks: chunk => chunk.name === paragonThemeCss.core.entryName,
119+
enforce: true,
120+
},
120121
};
122+
121123
Object.values(paragonThemeCss.variants).forEach(({ entryName, outputChunkName }) => {
122124
cacheGroups[outputChunkName] = {
123125
type: 'css/mini-extract',
@@ -139,11 +141,11 @@ function getParagonCacheGroups(paragonThemeCss) {
139141
* ```
140142
*/
141143
function getParagonEntryPoints(paragonThemeCss) {
142-
const entryPoints = {};
143144
if (!paragonThemeCss) {
144-
return entryPoints;
145+
return {};
145146
}
146-
entryPoints[paragonThemeCss.core.entryName] = path.resolve(process.cwd(), paragonThemeCss.core.filePath);
147+
148+
const entryPoints = { [paragonThemeCss.core.entryName]: path.resolve(process.cwd(), paragonThemeCss.core.filePath) };
147149
Object.values(paragonThemeCss.variants).forEach(({ filePath, entryName }) => {
148150
entryPoints[entryName] = path.resolve(process.cwd(), filePath);
149151
});

0 commit comments

Comments
 (0)