Closed js1972 closed 7 years ago
Hi Jason,
although ES6 modules (with import and export statements) are already es2015 standard, these are not supported by nodejs out-of-the-box, yet. Here is an article describing this missing nodejs feature in depth very well: https://medium.com/the-node-js-collection/an-update-on-es6-modules-in-node-js-42c958b890c
To enable ES6 modules to be used in nodejs, babel can be used in the project. Copy the .babelrc file from openui5-gulp-starter-kit into your project and make sure that the following npm modules are installed: babel-cli, pabel-preset-es2015, and babel-preset-stage-0. (e.g. just run yarn add babel-cli pabel-preset-es2015 babel-preset-stage-0 --dev)
Now at yarn start, the configuration of the .babelrc file is used automatically to execute the file gulpfile.babel.js.
Please let me know if you have any questions, hope the info has helped you.
Kind Regards, Jascha
Am 21.07.2017 um 05:59 schrieb Jason Scott notifications@github.com:
Hi. I'm trying to use this template and add it to an existing ui5 app.
I run yarn and the dependencies get installed from the package.json But when I then run yarn start I get the following error:
yarn start v0.27.5 $ gulp --silent /Users/jason/repos/fiori_ses_create_2/gulpfile.babel.js:15 import pkg from './package.json'; ^^^^^^ SyntaxError: Unexpected token import at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at loader (/Users/jason/repos/fiori_ses_create_2/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (/Users/jason/repos/fiori_ses_create_2/node_modules/babel-register/lib/node.js:154:7) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) error Command failed with exit code 1. It seems that gulp does not understand the import pkg statement at the top of the package.json.
Yet if I clone this repo yarn start works fine.
Is there some installation step that I could be missing?!?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pulseshift/openui5-gulp-starter-kit/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AITaU6nNUZsRXW2jFmnkR0xx9IeMsy_eks5sQCIvgaJpZM4Oe7pI.
Didn't have the .babelrc. ! Thanks. ;-)
Hi. I'm trying to use this template and add it to an existing ui5 app.
I run
yarn
and the dependencies get installed from the package.json But when I then runyarn start
I get the following error:It seems that gulp does not understand the import pkg statement at the top of the package.json.
Yet if I clone this repo yarn start works fine.
Is there some installation step that I could be missing?!?