/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/library/module-external-array-request/webpack.config.js
48 строк
938 B
hai-x
fix: return to namespace import when the external request includes a specific export (#20126)
17 ноя 2025, 17:53
Не верифицирован
17 ноя 2025, 17:53
27c05c7
Код
Авторство
О чём код?
"use strict"; const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); /** @type {webpack.Configuration} */ module.exports = { mode: "production", entry: "./index.js", output: { module: true, library: { type: "module" } }, experiments: { outputModule: true }, externals: { external: ["./external.mjs", "inner"] }, externalsType: "module", 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 }, () => { const data = fs.readFileSync( path.resolve(__dirname, "./external.mjs") ); compilation.emitAsset( "external.mjs", new webpack.sources.RawSource(data) ); } ); }); } } ] };