diff --git a/app/templates/babelrc b/app/templates/babelrc index a29ac998..17ab5760 100644 --- a/app/templates/babelrc +++ b/app/templates/babelrc @@ -1,5 +1,10 @@ { "presets": [ - "@babel/preset-env" + ["@babel/preset-env", { + "sourceType": "unambiguous", + "targets": { + "esmodules": true + } + }] ] -} +} \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index ed9664f8..3e418190 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -116,7 +116,11 @@

'Allo, 'Allo!

<%_ } -%> + <%_ if (includeUnit) { -%> + + <%_ } else { -%> + <%_ } -%> diff --git a/app/templates/main.js b/app/templates/main.js index 3b21d0d9..cb478f12 100644 --- a/app/templates/main.js +++ b/app/templates/main.js @@ -1,4 +1,12 @@ -console.log('\'Allo \'Allo!'); +<%_ if (includeUnit) { -%> +export function greeting() { + return '\'Allo \'Allo!'; +} + +console.log(greeting()); +<%_ } else { -%> + console.log('\'Allo \'Allo!'); +<%_ } -%> <%_ if (includeBootstrap) { -%> // Uncomment to enable Bootstrap tooltips