Skip to content

Commit 7459a87

Browse files
Jinjiangyyx990803
authored andcommitted
fix: handle default export in custom blocks (#1081)
1 parent b526349 commit 7459a87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/loader.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,11 @@ module.exports = function (content) {
380380

381381
output +=
382382
'var customBlock = ' + requireString + '\n' +
383-
'if (typeof customBlock === "function") {' +
384-
' customBlock(Component)' +
383+
'if (customBlock && customBlock.__esModule) {\n' +
384+
' customBlock = customBlock.default\n' +
385+
'}\n' +
386+
'if (typeof customBlock === "function") {\n' +
387+
' customBlock(Component)\n' +
385388
'}\n'
386389
}
387390
})

0 commit comments

Comments
 (0)