webpack
webpack copied to clipboard
externalsType.promise are not awaited in bundled dependencies
Bug report
What is the current behavior? Externals of type 'promise' are passed as promise (not as awaited value) to bundled amd type dependencies.
If the current behavior is a bug, please provide the steps to reproduce.
src/index.js
import internalValue from 'greetings';
import depValue from './dep.js';
console.log(internalValue, depValue);
alert(internalValue === depValue);
src/dep.js
define(['greetings'], (dep) => dep);
webpack.config.js
module.exports = {
mode: 'development',
externals: (ctx, callback) => {
if (ctx.request === 'greetings') {
callback(null, `Promise.resolve('Hello there!');`, 'promise');
} else {
callback();
}
},
};
What is the expected behavior?
Promise type externals are passed to bundled dependencies as awaited value
Other relevant information: webpack version: 5.95.0 Node.js version: 22.6.0 Operating System: macOS 15.0 Additional tools: -