Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
load(id) {
const inlineEntryId = findInlineEntryId(id);
// if this is an inline entry, take the inline module index from the import and return it's content
if (typeof inlineEntryId === 'number') {
return inlineModules[inlineEntryId];
}
// defer loading to other plugins / rollup
return null;
},
resolveId(source, importer) {
// if this is an inline entry keep it, load() will take ca,re of it
if (typeof findInlineEntryId(source) === 'number') {
return source;
}
if (Array.isArray(inlineImportMaps) && inlineImportMaps.length > 0) {
// exclude entry points as they may get provided as `main.js` without a path
// which would be considered bare module according to import map spec
if (
rollupOptions.input &&
Array.isArray(rollupOptions.input) &&
rollupOptions.input.includes(source)
) {
return null;
}
const { rootDir = process.cwd() } = localPluginConfig;
const basePath = importer ? importer.replace(rootDir, `${rootDir}::`) : `${rootDir}::`;