mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(webpack): DeprecationWarning DEP_WEBPACK_COMPILATION_ASSETS (#57)
This commit is contained in:
parent
5a7f5164f0
commit
20c2375e74
@ -5,10 +5,15 @@
|
||||
|
||||
import hash from 'hash-sum'
|
||||
import uniq from 'lodash/uniq'
|
||||
import { Compilation } from 'webpack'
|
||||
|
||||
import { isJS, isCSS } from './util'
|
||||
|
||||
export default class VueSSRClientPlugin {
|
||||
options: {
|
||||
filename: string
|
||||
}
|
||||
|
||||
constructor (options = {}) {
|
||||
this.options = Object.assign({
|
||||
filename: null
|
||||
@ -16,7 +21,11 @@ export default class VueSSRClientPlugin {
|
||||
}
|
||||
|
||||
apply (compiler) {
|
||||
compiler.hooks.emit.tapAsync('vue-client-plugin', (compilation, cb) => {
|
||||
compiler.hooks.make.tap('VueSSRClientPlugin', (compilation: any) => {
|
||||
compilation.hooks.processAssets.tapAsync({
|
||||
name: 'VueSSRClientPlugin',
|
||||
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
||||
}, (assets, cb) => {
|
||||
const stats = compilation.getStats().toJson()
|
||||
|
||||
const allFiles = uniq(stats.assets
|
||||
@ -101,11 +110,12 @@ export default class VueSSRClientPlugin {
|
||||
|
||||
const src = JSON.stringify(manifest, null, 2)
|
||||
|
||||
compilation.assets[this.options.filename] = {
|
||||
assets[this.options.filename] = {
|
||||
source: () => src,
|
||||
size: () => src.length
|
||||
}
|
||||
cb()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user