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