-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
Bug
When passing modules via the require.cache() API, it does not work as expected.
Code
require.cache({
'some/module/mid': () => { define('some/module/mid', [ 'dependency' ], (dependency) => { /* module */ }
});
require([ 'some/module/mid' ], (someModule) => { /* stuff */ };Expected behavior:
This should run without issue.
Actual behavior:
The loader will report it cannot load some/module/mid. In order to make it available, you have to
do something like this:
require.cache({
'some/module/mid': () => { define('some/module/mid', [ 'dependency' ], (dependency) => { /* module */ }
});
require.cache({});
require([ 'some/module/mid' ], (someModule) => { /* stuff */ };Which will cause the loader to actually consume the provided cached modules.
I suspect this is mainly because there are not tests around the .cache() API that this is why this is undetected.