blob: c494e4e5d76e980958c3391f4f1c034185c142d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
"use strict";
/**
* A Rollup plugin accepting a file overrides map and changing
* module sources to the overridden ones where provided. Files
* without overrides are loaded from disk.
*
* @param {Map<string, string>} fileOverrides
*/
module.exports = ( fileOverrides ) => {
return {
name: "jquery-file-overrides",
load( id ) {
if ( fileOverrides.has( id ) ) {
// Replace the module by a fake source.
return fileOverrides.get( id );
}
// Handle this module via the file system.
return null;
}
};
};
|