File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -275,15 +275,25 @@ module.exports = function (content) {
275275
276276 // add requires for customBlocks
277277 if ( parts . customBlocks && parts . customBlocks . length ) {
278- output += '\n/* customBlocks */\n'
278+ var addedPrefix = false
279+
279280 parts . customBlocks . forEach ( function ( customBlock , i ) {
280- // require customBlock
281- customBlock . src = customBlock . attrs . src
282- var requireString = customBlock . src
283- ? getRequireForImport ( customBlock . type , customBlock )
284- : getRequire ( customBlock . type , customBlock , i )
281+ if ( ! loaders [ customBlock . type ] ) {
282+ loaderContext . emitWarning ( 'Loader for custom block type "' + customBlock . type + '" not found in webpack configuration' )
283+ } else {
284+ // require customBlock
285+ customBlock . src = customBlock . attrs . src
286+ var requireString = customBlock . src
287+ ? getRequireForImport ( customBlock . type , customBlock )
288+ : getRequire ( customBlock . type , customBlock , i )
289+
290+ if ( ! addedPrefix ) {
291+ output += '\n/* customBlocks */\n'
292+ addedPrefix = true
293+ }
285294
286- output += requireString
295+ output += requireString
296+ }
287297 } )
288298 }
289299
You can’t perform that action at this time.
0 commit comments