mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
ccada8bccc
Fixes https://github.com/nodejs/loaders/issues/138 PR-URL: https://github.com/nodejs/node/pull/47824 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
31 lines
746 B
JavaScript
31 lines
746 B
JavaScript
export function load(url, context, nextLoad) {
|
|
switch (url) {
|
|
case 'byop://1/index.mjs':
|
|
return {
|
|
source: 'console.log("index.mjs!")',
|
|
format: 'module',
|
|
shortCircuit: true,
|
|
};
|
|
case 'byop://1/index2.mjs':
|
|
return {
|
|
source: 'import c from "./sub.mjs"; console.log(c);',
|
|
format: 'module',
|
|
shortCircuit: true,
|
|
};
|
|
case 'byop://1/sub.mjs':
|
|
return {
|
|
source: 'export default 42',
|
|
format: 'module',
|
|
shortCircuit: true,
|
|
};
|
|
case 'byop://1/index.byoe':
|
|
return {
|
|
source: 'console.log("index.byoe!")',
|
|
format: 'module',
|
|
shortCircuit: true,
|
|
};
|
|
default:
|
|
return nextLoad(url, context);
|
|
}
|
|
}
|