/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/worker/node-worker-esm/test.config.js
30 строк
719 B
Alexander Akait
feat: widen analyzable ESM output to shared, css, hinted and worker chunks (#21626)
07 авг 2026, 14:48
Не верифицирован
07 авг 2026, 14:48
56aba9f
Код
Авторство
О чём код?
"use strict"; const fs = require("fs"); const path = require("path"); module.exports = { findBundle() { return "./bundle.mjs"; }, moduleScope(scope) { scope.URL = URL; }, afterExecute(options) { const workerCode = fs.readFileSync( path.resolve(options.output.path, "./worker_js.bundle.mjs"), "utf8" ); // Either the runtime chunk-loading handler or the analyzable literal that // replaces it — both load the async chunk with `import()`. if ( !/import\(\) chunk loading for javascript/.test(workerCode) && !/import\([^;]*"\.\/chunk_js\.bundle\.mjs"\)/.test(workerCode) ) { throw new Error( "import() was not found in the worker code for loading async chunks" ); } } };