One alternative is not to use ES6 modules and continue using AMD modules as before.
Per yuri , the AMD syntaxis will continue to be supported "maybe forever" and curently the ES6 modules are actually transpiled back to AMD modules for execution.
The main advantage of using ES6 modules, for those that care about it, is the support from IDE applications like PhpStorm.
Announcement
Collapse
No announcement yet.
Custom ES6 controller: cannot use import statement outside a module
Collapse
X
-
You can use ES6 modules only from within an Espo module, it's not supported for custom folder customizations.
When you run init from the ext-template repository, the script will ask whether you want to use ES6, but it will only work for new extensions you develop.
Leave a comment:
-
This has been figured out. Please see the issue on Github in my previous post for more details.
Leave a comment:
-
Custom ES6 controller: cannot use import statement outside a module
I created files according to this page. The following works as expected:
Code:define('calendar2:controllers/calendar2', ['controllers/record'], function (Dep) { return Dep.extend({ actionHello: function (options) { console.log('action: hello'); }, }); });
Code:action: hello
Code:import Controller from 'controllers/record'; class Calendar2Controller extends Controller { actionHello(options) { console.log("action: hello") } } export default Calendar2Controller;
The source in the developer window shows an anonymous function, which is not in my file:
How is this supposed to work?Tags: None
Leave a comment: