mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
fix(webpack): handle new webpack chunk format
This commit is contained in:
parent
784a28df97
commit
d293c06d2a
@ -88,9 +88,18 @@ export function dynamicRequire ({ dir, ignore, inline }: Options): Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WebpackChunk = {
|
||||||
|
id: string
|
||||||
|
ids: string[]
|
||||||
|
modules: Record<string, unknown>
|
||||||
|
__webpack_id__?: string
|
||||||
|
__webpack_ids__?: string[]
|
||||||
|
__webpack_modules__?: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
async function getWebpackChunkMeta (src: string) {
|
async function getWebpackChunkMeta (src: string) {
|
||||||
const chunk = await importModule<{ id: string, ids: string[], modules: Record<string, unknown> }>(src) || {}
|
const chunk = await importModule<WebpackChunk>(src) || {}
|
||||||
const { id, ids, modules } = chunk
|
const { __webpack_id__, __webpack_ids__, __webpack_modules__, id = __webpack_id__, ids = __webpack_ids__, modules = __webpack_modules__ } = chunk
|
||||||
if (!id && !ids) {
|
if (!id && !ids) {
|
||||||
return null // Not a webpack chunk
|
return null // Not a webpack chunk
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user