Skip to content

Commit 8a28426

Browse files
committed
fix: resolve native ES modules
1 parent 5cc2d05 commit 8a28426

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/util/resolve-components.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function resolveAsyncComponents (matched: Array<RouteRecord>): Function {
2020
pending++
2121

2222
const resolve = once(resolvedDef => {
23-
if (resolvedDef.__esModule && resolvedDef.default) {
23+
if (isESModule(resolvedDef)) {
2424
resolvedDef = resolvedDef.default
2525
}
2626
// save resolved on async factory in case it's used elsewhere
@@ -86,6 +86,14 @@ export function flatten (arr: Array<any>): Array<any> {
8686
return Array.prototype.concat.apply([], arr)
8787
}
8888

89+
const hasSymbol =
90+
typeof Symbol === 'function' &&
91+
typeof Symbol.toStringTag === 'symbol'
92+
93+
function isESModule (obj) {
94+
return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
95+
}
96+
8997
// in Webpack 2, require.ensure now also returns a Promise
9098
// so the resolve/reject functions may get called an extra time
9199
// if the user uses an arrow function shorthand that happens to

0 commit comments

Comments
 (0)