Skip to content

VM and Dartium don't respect @lazy and DeferredLibrary #10171

@DartBot

Description

@DartBot

This issue was originally filed by @sethladd


Consider this code:

import 'dart:html';
import 'dart:async';

@lazy
import 'reverser.dart';

const lazy = const DeferredLibrary('reverser', uri: './part.js');

void main() {
  print('in main');
  new Timer(const Duration(seconds:3), () {
    lazy.load().then((_) {
      print('library loaded');
      query("#sample_text_id")
        ..text = "Click me!"
        ..onClick.listen(reverseText);
    });
  });
}

void reverseText(MouseEvent event) {
  query("#sample_text_id").text = reverse(query("#sample_text_id").text);
}

In the network panel of Dev Tools, I see the request for reverser.dart immediately on page load. I was expecting now to see the request until after the Timer fires.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.closed-obsoleteClosed as the reported issue is no longer relevanttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions