rsnext/packages/next/build/webpack/plugins/all-modules-identified-plugin.ts
Joe Haddad 1fb1b75216
Ensure all modules are identified (#6656)
* Ensure all modules are identified

* Extend a webpack Plugin

Co-Authored-By: Timer <timer150@gmail.com>
2019-03-14 11:04:08 -04:00

22 lines
594 B
TypeScript

import { Compiler, Plugin } from 'webpack'
export class AllModulesIdentifiedPlugin implements Plugin {
apply(compiler: Compiler) {
compiler.hooks.compilation.tap(
'AllModulesIdentifiedPlugin',
compilation => {
compilation.hooks.beforeModuleIds.tap(
'AllModulesIdentifiedPlugin',
modules => {
;(modules as any[]).forEach(module => {
if (module.id != null || !module.identifier) {
return
}
module.id = module.identifier()
})
}
)
}
)
}
}