Skip to content
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

Closed
alan-knight opened this issue Aug 27, 2013 · 9 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant web-dart2js

Comments

@alan-knight
Copy link
Contributor

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)

@kasperl
Copy link

kasperl commented Sep 18, 2013

Added this to the M7 milestone.

@kasperl
Copy link

kasperl commented Sep 30, 2013

Removed Priority-Unassigned label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Oct 2, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@sethladd
Copy link
Contributor

Removed this from the M8 milestone.

@floitschG
Copy link
Contributor

Set owner to @sigurdm.

@pavelgj
Copy link

pavelgj commented Apr 2, 2014

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.

@floitschG
Copy link
Contributor

We recently removed the limitation in r33428.
Is this still an issue?
If yes, we need to investigate.

@pavelgj
Copy link

pavelgj commented Apr 2, 2014

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.

@floitschG
Copy link
Contributor

Deferred loading should work correctly now.
Please reopen if you still encounter issues.


Added AssumedStale label.

@alan-knight alan-knight added Type-Defect web-dart2js closed-obsolete Closed as the reported issue is no longer relevant labels Sep 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant web-dart2js
Projects
None yet
Development

No branches or pull requests

6 participants