Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (resources.inlineModules.length > 0) {
throw new Error(
`Compatibility cannot handle "inline" modules (modules without a src attribute). Place your js code in a separate file.`,
);
}
if (!resources.jsModules || resources.jsModules.length === 0) {
throw new Error(
`Compatibility mode requires at least one
const files = [
...resources.jsModules,
...[...inlineModules.keys()].map(e => `${e}?source=${encodeURIComponent(cfg.indexUrl)}`),
];
if (files.length === 0) {
return {
indexHTML: cfg.indexHTMLString,
inlineModules: new Map(),
polyfills: [],
};
}
// create a new index.html with injected polyfills and loader script
const createResult = createIndexHTML(resources.indexHTML, {
entries: {
type: polyfillModules ? 'system' : 'module',
polyfillDynamicImport: false,
files,
},
polyfills: getPolyfills(cfg),
minify: false,
preload: false,
});
let { indexHTML } = createResult;
if (polyfillModules) {
indexHTML = addPolyfilledImportMaps(indexHTML, resources);
}
// inject systemjs resolver which appends a query param to trigger es5 compilation