Open tomc974 opened 6 years ago
@tomc974 this should work. Could you provide a bit more information about what you're including in your app and what the run-time error is that you get and in which run-time environments? My guess without having any details is that there may be a missing polyfill or shim that might still be needed for certain features in some browsers. Though it's always possible we missed something, so if you can share more details that would be helpful. Thanks!
@dylans Thanks for your answer. Here are some details about my environment:
I build the website with dojo build --mode dev -w memory -s
and in the console I have the following error :
Uncaught TypeError: Class constructor HelloWorld cannot be invoked without 'new'
SCRIPT5632: Class constructor cannot be called without the new keyword
To reproduce, just create a project with dojo create app --name dummy
and change the target in tsconfig.json
to es2015
. The error occurs with just that modification.
This appears to be caused in this case by the ProjectorMixin
expecting the widget passed to it to not be a ES class. This is because the Dojo packages are compiled to ES5, so the ProjectorMixin
is attempting to call apply
on the class, which isn't allowed.
We do currently ship es2015 classes that are used with the cli-build-widget commands to target evergreen browsers, but do not currently enable that functionality for cli-build-app commands. We would like to switch this up and support evergreen browsers first, as discussed in dojo/cli-build-app#64 and dojo/cli-build-app#65.
This is fixed as a forwards compatible change by https://github.com/dojo/cli-build-app/pull/100. And will be in cli-build-app version 2.0.1
Hi,
I'm currently trying to build a simple app with Dojo 2 and used the
dojo-cli
to create a project. I noticed in the generatedtsconfig.json
that the target is set toes5
. With this setting my application is working fine, however if I try to set the target to ES2015+, I get a run-time error.To reproduce this issue, just create a project with
dojo-cli
and change the target intsconfig.json
toes2015
.So now I'm wondering why a brand new framework like Dojo 2 can't be compiled to ES2015+...