/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/output-html-split-chunks/webpack.config.js
48 строк
1 KB
Alexander Akait
feat(html): generate output.html for entrypoints with dependOn support (#21215)
18 июн 2026, 23:04
Не верифицирован
18 июн 2026, 23:04
868209f
Код
Авторство
О чём код?
"use strict"; const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").WebpackPluginInstance} */ const copyTest = { apply(compiler) { compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL }, () => { compilation.emitAsset( "test.js", new webpack.sources.RawSource( fs.readFileSync(path.resolve(__dirname, "test.js")) ) ); } ); }); } }; // `runtimeChunk` + `splitChunks` produce extra initial chunks; the page must // inject all of them (runtime, vendor, entry) in dependency order. /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", entry: { app: "./src/app.js" }, output: { filename: "[name].js", html: true }, optimization: { minimize: false, runtimeChunk: "single", splitChunks: { chunks: "all", cacheGroups: { vendor: { test: /node_modules/, name: "vendor", enforce: true } } } }, experiments: { html: true }, plugins: [copyTest] };