UNPKG

next

Version:

The React Framework

31 lines (30 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ServerlessPlugin { apply(compiler) { compiler.hooks.compilation.tap('ServerlessPlugin', (compilation)=>{ const hook = compilation.hooks.optimizeChunks; hook.tap('ServerlessPlugin', (chunks)=>{ for (const chunk of chunks){ // If chunk is not an entry point skip them if (!chunk.hasEntryModule()) { continue; } // Async chunks are usages of import() for example const dynamicChunks = chunk.getAllAsyncChunks(); for (const dynamicChunk of dynamicChunks){ // @ts-ignore TODO: Remove ignore when webpack 5 is stable for (const module of compilation.chunkGraph.getChunkModulesIterable(dynamicChunk)){ // Add module back into the entry chunk chunk.addModule(module); } } } }); }); } } exports.ServerlessPlugin = ServerlessPlugin; //# sourceMappingURL=serverless-plugin.js.map