/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/plugins/virtual-url-plugin-absolute-context/webpack.config.js
29 строк
857 B
Xiao
fix: VirtualUrlPlugin absolute-path virtual module IDs getting concatenated with compiler context (#20656)
17 мар 2026, 13:46
Не верифицирован
17 мар 2026, 13:46
6784091
Код
Авторство
О чём код?
"use strict"; const path = require("path"); const webpack = require("../../../../"); const { VirtualUrlPlugin } = webpack.experiments.schemes; // The virtual module ID is an absolute path. // When context is "auto", the plugin should derive the context from that // absolute path directly, not concatenate it with compiler.context. const virtualModulePath = path.join(__dirname, "virtual-entry.js"); /** @type {import("webpack").Configuration} */ const config = { entry: `virtual:${virtualModulePath}`, plugins: [ new VirtualUrlPlugin({ [virtualModulePath]: { context: "auto", source() { return "import { value } from './helper.js'; it('should resolve relative imports from absolute-path virtual modules', (done) => { expect(value).toBe('helper-value'); done(); });"; } } }) ], validate: true }; module.exports = config;