fix(webpack): use default export from webpack (#19166)

This commit is contained in:
Daniel Roe 2023-02-20 20:34:33 +00:00 committed by GitHub
parent 268cded26c
commit d2481f9675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,12 @@
import type { Compiler } from 'webpack'
import { RuntimeGlobals } from 'webpack'
import webpack from 'webpack'
const pluginName = 'ChunkErrorPlugin'
const script = `
if (typeof ${RuntimeGlobals.require} !== "undefined") {
var _ensureChunk = ${RuntimeGlobals.ensureChunk};
${RuntimeGlobals.ensureChunk} = function (chunkId) {
if (typeof ${webpack.RuntimeGlobals.require} !== "undefined") {
var _ensureChunk = ${webpack.RuntimeGlobals.ensureChunk};
${webpack.RuntimeGlobals.ensureChunk} = function (chunkId) {
return Promise.resolve(_ensureChunk(chunkId)).catch(err => {
const e = new Event("nuxt.preloadError");
e.payload = err;