/** * Inline the dynamic chunk requires of the webpack runtime. * * The webpack runtime loads chunks with a dynamic require that ESBuild can not bundle: * * installChunk(require("./chunks/" + __webpack_require__.u(chunkId))); * * `__webpack_require__.u` returns `.js`, or `.js` for a named chunk (`webpackChunkName`). * The require is replaced with a switch over the existing chunk files: * * installChunk(((path) => { * switch (path) { * case "./chunks/123.js": return require("./chunks/123.js"); * case "./chunks/named.js": return require("./chunks/named.js"); * default: throw new Error(`Unknown chunk ${path}`); * } * })("./chunks/" + __webpack_require__.u(chunkId))); */ /** * Builds the rule inlining the dynamic chunk require. * * @param chunks Chunk files, relative to the chunks folder (i.e. `123.js`, `named-chunk.js`). * @returns The ast-grep rule. */ export declare function buildChunkRequireRule(chunks: string[]): string; /** * Lists the chunk files. * * Named chunks can be nested (i.e. `webpackChunkName: "dir/name"` is emitted as `chunks/dir/name.js`). * * @param chunksDir Path to the chunks folder. * @returns The `.js` files, relative to the chunks folder and using `/` as the separator. */ export declare function listChunks(chunksDir: string): string[]; /** * Fixes the webpack-runtime.js and webpack-api-runtime.js files by inlining * the webpack dynamic requires. * * @param dotNextServerDir Path to the `.next/server` folder. * @param chunks The chunks to inline, relative to the chunks folder. Defaults to all the chunk files. */ export declare function patchWebpackRuntime(dotNextServerDir: string, chunks?: string[]): Promise;