Skip to content

Commit

Permalink
fix(app): webcomponent menu transpilation with Babel and missing file…
Browse files Browse the repository at this point in the history
…name config for @babel/preset-env

fix #1100
  • Loading branch information
vogloblinsky committed Jul 15, 2021
1 parent 0862747 commit 10f73a5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2408,6 +2408,7 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);

private transpileMenuWCToES5(es6Code) {
return babel.transformAsync(es6Code, {
filename: 'menu-wc_es5.js',
presets: [
[
'@babel/preset-env',
Expand All @@ -2425,8 +2426,14 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
logger.info('Process menu...');

return new Promise((resolveProcessMenu, rejectProcessMenu) => {
const finalPathES6 = `${mainData.output}/js/menu-wc.js`;
const finalPathES5 = `${mainData.output}/js/menu-wc_es5.js`;
let output = mainData.output.slice();
const outputLastCharacter = output.lastIndexOf('/');
if (outputLastCharacter !== -1) {
output = output.slice(0, -1);
}
const finalPathES6 = `${output}/js/menu-wc.js`;
const finalPathES5 = `${output}/js/menu-wc_es5.js`;

HtmlEngine.renderMenu(Configuration.mainData.templates, mainData)
.then(htmlData => {
FileEngine.write(finalPathES6, htmlData)
Expand Down Expand Up @@ -2455,11 +2462,13 @@ at least one config for the 'info' or 'source' tab in --navTabConfig.`);
})
.catch(err => {
logger.error('Error during ' + finalPathES6 + ' page generation');
logger.error(err);
return rejectProcessMenu('');
});
})
.catch(err => {
logger.error('Error during ' + finalPathES6 + ' page generation');
logger.error(err);
return rejectProcessMenu('');
});
});
Expand Down

0 comments on commit 10f73a5

Please sign in to comment.