mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(webpack5): plugins/vue/server DeprecationWarning
This commit is contained in:
parent
dc84429d67
commit
8936fe77eb
@ -9,8 +9,8 @@ export default class VueSSRServerPlugin {
|
||||
|
||||
apply (compiler) {
|
||||
validate(compiler)
|
||||
|
||||
compiler.hooks.emit.tapAsync('vue-server-plugin', (compilation, cb) => {
|
||||
compiler.hooks.make.tap('VueSSRServerPlugin', (compilation: any) => {
|
||||
compilation.hooks.processAssets.tapAsync('VueSSRServerPlugin', (assets, cb) => {
|
||||
const stats = compilation.getStats().toJson()
|
||||
const [entryName] = Object.keys(stats.entrypoints)
|
||||
const entryInfo = stats.entrypoints[entryName]
|
||||
@ -54,13 +54,13 @@ export default class VueSSRServerPlugin {
|
||||
bundle.maps[asset.name.replace(/\.map$/, '')] = asset.name
|
||||
} else {
|
||||
// Do not emit non-js assets for server
|
||||
delete compilation.assets[asset.name]
|
||||
delete assets[asset.name]
|
||||
}
|
||||
})
|
||||
|
||||
const src = JSON.stringify(bundle, null, 2)
|
||||
|
||||
compilation.assets[this.options.filename] = {
|
||||
assets[this.options.filename] = {
|
||||
source: () => src,
|
||||
size: () => src.length
|
||||
}
|
||||
@ -68,4 +68,5 @@ export default class VueSSRServerPlugin {
|
||||
cb()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user