I recently used Yeoman to scaffold a new Silverstripe project with the silverstripe-module generator. I have npm 2.15.0, node is 4.4.2, and I also updated lodash before running the generator.
Now inside of my dev env (Aptana studio 3), I cloned a git repo (it's an empty private repo), and ran the generator to scaffold a new project in there. Everything works fine. Just a warning about updating graceful-fs. However, there are several JS errors that have popped up in the Javascript and node_modules>babel-core folders. They are all "Syntax error: unexpected token " errors. E.g. in the javascript folder, there are two files, where even simple keywords like "import" and "class" are being shown as unexpected tokens.
import is the unexpected token in Main.js:
/**
* This is the entry point to your front-end application.
* Browserify will create a dependency graph starting from this file,
* the result will be bundled, and written to javascript/dist/bundle.js which
* you can include using Requirements::javascript in your controller.
*/
import ExampleComponent from './example-component';
$('.example-component-wrapper').entwine({
onadd: function () {
var component = new ExampleComponent();
component.doStuff();
}
});
class and export are the unexpected tokens in example-component.js:
/**
* A component that can do stuff.
*/
class ExampleComponent {
constructor() {
}
doStuff() {
return true;
}
}
export default ExampleComponent;
There are many, many such errors in the node_modules folder. Any ideas?
As commented by @FinBoWa above, the development environment is the problem. It doesn't have support for ES6.
stackoverflow.com/questions/30901152/does-aptana-support-es6