/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/module/non-webpack-require-warning/webpack.config.js
53 строки
978 B
hai-x
fix: `needCreateRequire` should be set to true only when module output and node target (#19761)
25 авг 2025, 21:23
Не верифицирован
25 авг 2025, 21:23
0768631
Код
Авторство
О чём код?
"use strict"; const webpack = require("../../../../"); /** @type {import("../../../../").Configuration[]} */ module.exports = [ { output: { module: true }, target: ["node"], experiments: { outputModule: true }, plugins: [ { apply(compiler) { compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-webpack-plugin", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL }, () => { compilation.emitAsset( "bar.js", new webpack.sources.RawSource("module.exports = 1;") ); } ); }); } } ] }, { output: { module: true }, target: "web", experiments: { outputModule: true }, plugins: [ new webpack.BannerPlugin({ raw: true, banner: 'import { createRequire } from "module"; const require = createRequire(import.meta.url)' }) ] } ];