New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deferred loading doesn't generate part.js if lazy loading is not in the main library, crashes when run #12824
Comments
Added this to the M7 milestone. |
Removed Priority-Unassigned label. |
Removed this from the M8 milestone. |
Set owner to @sigurdm. |
Sorry for the noise, but just wanted to let you know that it's an issue for us as well. Specifically when doing codegen for deferred library definitions outside of entrypoint. |
We recently removed the limitation in r33428. |
I think I ran into this issue in one of the early versions of 1.3, not sure what revision number it was. But I'll recheck. Thanks. |
Deferred loading should work correctly now. Added AssumedStale label. |
Deferred loading seems to work reasonably if the lazy imports are in the main library. However, if they're in an imported library, then part.js is not generated, and trying to load the library fails at runtime. You can see this in that
$dartj2s lazy.dart
Dart file lazy.dart compiled to JavaScript: out.js
$ d8 out.js
Before loading: null
Lib2:
Two
but
$ dart2js lazyIndirectly.dart
Dart file lazyIndirectly.dart compiled to JavaScript: out.js
$ d8 out.js
Before loading: Closure
part.js:2: ReferenceError: $ is not defined
var old$ = $;
^
ReferenceError: $ is not defined
at part.js:2:12
at _load_closure0.call$0 (out.js:2257:5)
at _DefaultZone._ZoneBase._runInZone$2 (out.js:2775:16)
at _ZoneTimer._run$0 (out.js:2840:8)
at BoundClosure$0.$$.BoundClosure$0.call$0 (out.js:25:36)
at TimerImpl_internalCallback.call$0 (out.js:1392:21)
at _IsolateContext.eval$1 (out.js:632:21)
at _IsolateEvent.process$0 (out.js:757:18)
at _EventLoop.runIteration$0 (out.js:713:12)
at _EventLoop._runHelper$0 (out.js:720:19)
Uncaught Error: Error executing file
out.js:2215: Error executing file
throw exception;
^
Error executing file
at wrapException (out.js:1565:13)
at _DefaultZone_handleUncaughtError_closure.call$0 (out.js:2824:13)
at Closure$_asyncRunCallback._asyncRunCallback as call$0
at TimerImpl_internalCallback.call$0 (out.js:1392:21)
at _IsolateContext.eval$1 (out.js:632:21)
at _IsolateEvent.process$0 (out.js:757:18)
at _EventLoop.runIteration$0 (out.js:713:12)
at _EventLoop._runHelper$0 (out.js:720:19)
at _EventLoop.run$0 (out.js:726:12)
at startRootIsolate (out.js:419:29)
Attachments:
lazy.dart (245 Bytes)
lazy2.dart (46 Bytes)
lazyIndirectly.dart (73 Bytes)
The text was updated successfully, but these errors were encountered: