Skip to content

Config specific imports don't work with analyzer/ddc #34177

@jakemac53

Description

@jakemac53

I have been working on a prototype to support config specific imports properly in package:build, and I have gotten something to work, but during compilation I get errors like this:

Error compiling dartdevc module:_test|web/main.ddc.js

[error] Target of URI doesn't exist: 'default.dart'. (/web/main.dart, line 7, col 8)
[error] Target of URI doesn't exist: 'ui.dart'. (/web/main.dart, line 8, col 26)
[error] Target of URI doesn't exist: 'io.dart'. (/web/main.dart, line 9, col 26)

Please fix all errors before compiling (warnings are okay).

my imports look like this:

import 'default.dart'
    if (dart.library.ui) 'ui.dart'
    if (dart.library.io) 'io.dart'
    if (dart.library.html) 'web.dart';

Note that you don't see the error about web.dart, because I did in fact provide that one (because I knew it was the only one that would actually be loaded).

I can work around the issue with // ignore: URI_DOES_NOT_EXIST comments (although I need one for every single condition...), but that shouldn't be necessary :).

It looks like this error is probably coming from the analyzer, but I am unsure if I should assign it to the dev_compiler or analyzer areas - assigning to analyzer for now but please switch if you feel that is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1A high priority bug; for example, a single project is unusable or has many test failureslegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions