Skip to content

Commit 6957237

Browse files
authored
fix(build): single individuals element breaks build
It seems that the current logic (below) to create file blob like {foo,bar,buz}.less assumes that config.globs.individuals is always like {a,b,c}, but it does not when individuals has only one single element. After This PR, config.globs.components and config.globs.individuals are {a,b,c} if those arrays has 1 or more elements, so build/css.js and build/javascript.js works regardless of the number of elements in individuals/components
1 parent 7445821 commit 6957237

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tasks/config/project/config.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,14 @@ module.exports = {
128128
}
129129

130130
// takes component object and creates file glob matching selected components
131-
config.globs.components = (typeof config.components == 'object')
132-
? (config.components.length > 1)
133-
? '{' + config.components.join(',') + '}'
134-
: config.components[0]
131+
config.globs.components = (Array.isArray(config.components) && config.components.length >= 1)
132+
? '{' + config.components.join(',') + '}'
135133
: '{' + defaults.components.join(',') + '}'
136134
;
137135

138136
// components that should be built, but excluded from main .css/.js files
139-
config.globs.individuals = (typeof config.individuals == 'object')
140-
? (config.individuals.length > 1)
141-
? '{' + config.individuals.join(',') + '}'
142-
: config.individuals[0]
137+
config.globs.individuals = (Array.isArray(config.individuals) && config.individuals.length >= 1)
138+
? '{' + config.individuals.join(',') + '}'
143139
: undefined
144140
;
145141

0 commit comments

Comments
 (0)