diff --git a/src/compiler/output-targets/dist-lazy/lazy-output.ts b/src/compiler/output-targets/dist-lazy/lazy-output.ts index 8f74a619ca6..1e5a7f545ad 100644 --- a/src/compiler/output-targets/dist-lazy/lazy-output.ts +++ b/src/compiler/output-targets/dist-lazy/lazy-output.ts @@ -67,8 +67,6 @@ export const outputLazy = async (config: d.Config, compilerCtx: d.CompilerCtx, b generateCjs(config, compilerCtx, buildCtx, rollupBuild, outputTargets), ]); - await generateLegacyLoader(config, compilerCtx, outputTargets); - if (componentBundle != null) { buildCtx.componentGraph = generateModuleGraph(buildCtx.components, componentBundle); } @@ -118,51 +116,3 @@ const getLazyEntry = (isBrowser: boolean) => { return s.toString(); }; - -const generateLegacyLoader = (config: d.Config, compilerCtx: d.CompilerCtx, outputTargets: d.OutputTargetDistLazy[]) => { - return Promise.all( - outputTargets.map(async o => { - if (o.legacyLoaderFile) { - const loaderContent = getLegacyLoader(config); - await compilerCtx.fs.writeFile(o.legacyLoaderFile, loaderContent, { outputTargetType: o.type }); - } - }), - ); -}; - -const getLegacyLoader = (config: d.Config) => { - const namespace = config.fsNamespace; - return ` -(function(doc){ - var scriptElm = doc.scripts[doc.scripts.length - 1]; - var warn = ['[${namespace}] Deprecated script, please remove: ' + scriptElm.outerHTML]; - - warn.push('To improve performance it is recommended to set the differential scripts in the head as follows:') - - var parts = scriptElm.src.split('/'); - parts.pop(); - parts.push('${namespace}'); - var url = parts.join('/'); - - var scriptElm = doc.createElement('script'); - scriptElm.setAttribute('type', 'module'); - scriptElm.src = url + '/${namespace}.esm.js'; - warn.push(scriptElm.outerHTML); - scriptElm.setAttribute('data-stencil-namespace', '${namespace}'); - doc.head.appendChild(scriptElm); - - ${ - config.buildEs5 && - ` - scriptElm = doc.createElement('script'); - scriptElm.setAttribute('nomodule', ''); - scriptElm.src = url + '/${namespace}.js'; - warn.push(scriptElm.outerHTML); - scriptElm.setAttribute('data-stencil-namespace', '${namespace}'); - doc.head.appendChild(scriptElm) - ` - } - console.warn(warn.join('\\n')); - -})(document);`; -}; diff --git a/src/declarations/stencil-public-compiler.ts b/src/declarations/stencil-public-compiler.ts index 020e2b6f908..a70d40ec25a 100644 --- a/src/declarations/stencil-public-compiler.ts +++ b/src/declarations/stencil-public-compiler.ts @@ -1680,7 +1680,6 @@ export interface OutputTargetDistLazy extends OutputTargetBase { esmIndexFile?: string; cjsIndexFile?: string; systemLoaderFile?: string; - legacyLoaderFile?: string; empty?: boolean; }