Skip to content

Commit

Permalink
feat(): generate empty entry point for loader
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Jun 26, 2019
1 parent fb6606d commit 144e966
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/compiler/output-targets/output-lazy-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ async function generateLoader(config: d.Config, compilerCtx: d.CompilerCtx, outp
'typings': './index.d.ts',
'module': './index.mjs',
'main': './index.cjs.js',
'node:main': './node-main.js',
'jsnext:main': './index.es2017.mjs',
'es2015': './index.es2017.mjs',
'es2017': './index.es2017.mjs'
'es2017': './index.es2017.mjs',
}, null, 2);

const es5EntryPoint = config.sys.path.join(es5Dir, 'loader.mjs');
Expand All @@ -54,6 +55,10 @@ export * from '${normalizePath(config.sys.path.relative(loaderPath, es2017EntryP
const indexCjsContent = `
module.exports = require('${normalizePath(config.sys.path.relative(loaderPath, cjsEntryPoint))}');
module.exports.applyPolyfills = function() { return Promise.resolve() };
`;
const nodeMainContent = `
module.exports.applyPolyfills = function() { return Promise.resolve() };
module.exports.defineCustomElements = function() { return Promise.resolve() };
`;

const indexDtsPath = config.sys.path.join(loaderPath, 'index.d.ts');
Expand All @@ -62,7 +67,8 @@ module.exports.applyPolyfills = function() { return Promise.resolve() };
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'index.d.ts'), generateIndexDts(config, indexDtsPath, outputTarget.componentDts)),
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'index.mjs'), indexContent),
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'index.cjs.js'), indexCjsContent),
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'index.es2017.mjs'), indexES2017Content)
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'index.es2017.mjs'), indexES2017Content),
compilerCtx.fs.writeFile(config.sys.path.join(loaderPath, 'node-main.js'), nodeMainContent)
]);
}

Expand Down

0 comments on commit 144e966

Please sign in to comment.