Skip to content

Commit

Permalink
refactor: change entryPoints and CacheGroups variable definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Jul 30, 2024
1 parent 73a83f4 commit dfdcbdb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions config/data/paragonUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,18 @@ function getParagonThemeCss(dir, { isBrandOverride = false } = {}) {
* @returns {Object.<string, CacheGroup>} The cache groups for the Paragon theme CSS.
*/
function getParagonCacheGroups(paragonThemeCss) {
const cacheGroups = {};
if (!paragonThemeCss) {
return cacheGroups;
return {};
}
cacheGroups[paragonThemeCss.core.outputChunkName] = {
type: 'css/mini-extract',
name: paragonThemeCss.core.outputChunkName,
chunks: chunk => chunk.name === paragonThemeCss.core.entryName,
enforce: true,
const cacheGroups = {
[paragonThemeCss.core.outputChunkName]: {
type: 'css/mini-extract',
name: paragonThemeCss.core.outputChunkName,
chunks: chunk => chunk.name === paragonThemeCss.core.entryName,
enforce: true,
},
};

Object.values(paragonThemeCss.variants).forEach(({ entryName, outputChunkName }) => {
cacheGroups[outputChunkName] = {
type: 'css/mini-extract',
Expand All @@ -139,11 +141,11 @@ function getParagonCacheGroups(paragonThemeCss) {
* ```
*/
function getParagonEntryPoints(paragonThemeCss) {
const entryPoints = {};
if (!paragonThemeCss) {
return entryPoints;
return {};
}
entryPoints[paragonThemeCss.core.entryName] = path.resolve(process.cwd(), paragonThemeCss.core.filePath);

const entryPoints = { [paragonThemeCss.core.entryName]: path.resolve(process.cwd(), paragonThemeCss.core.filePath) };
Object.values(paragonThemeCss.variants).forEach(({ filePath, entryName }) => {
entryPoints[entryName] = path.resolve(process.cwd(), filePath);
});
Expand Down

0 comments on commit dfdcbdb

Please sign in to comment.