/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/default-entry/webpack.config.js
41 строка
963 B
Alexander Akait
feat: resolve default ./src entry to index.html/index.css under experiments (#21039)
26 май 2026, 17:19
Не верифицирован
26 май 2026, 17:19
169b511
Код
Авторство
О чём код?
"use strict"; // `./src` with no extension must resolve `./src/index.html` when the html // experiment is on — the same way `./src` resolves `./src/index.js` by default. const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { entry: "./src", output: { filename: "[name].js", chunkFilename: "[name].chunk.js" }, experiments: { html: true }, plugins: [ { apply(compiler) { compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL }, () => { const data = fs.readFileSync(path.resolve(__dirname, "test.js")); compilation.emitAsset( "test.js", new webpack.sources.RawSource(data) ); } ); }); } } ] };