2021-10-06 17:40:01 +02:00
|
|
|
import { init as initWebpack } from 'next/dist/compiled/webpack/webpack'
|
2021-02-27 07:19:35 +01:00
|
|
|
|
2021-10-06 17:40:01 +02:00
|
|
|
let installed: boolean = false
|
2021-03-24 14:10:10 +01:00
|
|
|
|
2021-10-06 17:40:01 +02:00
|
|
|
export function loadWebpackHook() {
|
|
|
|
if (installed) {
|
|
|
|
return
|
2021-06-08 09:23:08 +02:00
|
|
|
}
|
2021-10-06 17:40:01 +02:00
|
|
|
installed = true
|
2021-06-02 11:19:48 +02:00
|
|
|
|
2021-10-06 17:40:01 +02:00
|
|
|
initWebpack()
|
2021-06-07 22:48:29 +02:00
|
|
|
|
2021-10-06 17:40:01 +02:00
|
|
|
// hook the Node.js require so that webpack requires are
|
|
|
|
// routed to the bundled and now initialized webpack version
|
|
|
|
require('../build/webpack/require-hook')
|
2021-02-27 07:19:35 +01:00
|
|
|
}
|