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

Can not skip dart:mirrors #1790

Closed
valotas opened this issue Aug 25, 2018 · 11 comments
Closed

Can not skip dart:mirrors #1790

valotas opened this issue Aug 25, 2018 · 11 comments

Comments

@valotas
Copy link

valotas commented Aug 25, 2018

Environment:

I get the following:

[SEVERE] build_web_compilers|ddc on lib/src/reflect.module (cached):
Error compiling dartdevc module:mustache4dart|lib/src/reflect.ddc.js

[error] Cannot import "dart:mirrors" in web applications (https://goo.gl/R1anEs). (package:mustache4dart/src/reflect_with_mirrors.dart, line 1, col 8)

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

which is true but reflect_with_mirrors.dart is conditionally imported only when dart.library.mirrors is available.

Is this behavior intended?

@matanlurey
Copy link
Contributor

I don't believe that conditional variable is actually supported.

@valotas
Copy link
Author

valotas commented Aug 25, 2018

Supported by dart or by build_web_compilers? How can I conditionally use mirrors?

@matanlurey
Copy link
Contributor

I do not believe you can

@matanlurey
Copy link
Contributor

We should probably fail early on unsupported conditional literals?

@jakemac53 @natebosch

@natebosch
Copy link
Member

We're moving forward with conditional import support. Not sure of a timing yet

@valotas
Copy link
Author

valotas commented Aug 25, 2018 via email

@jakemac53
Copy link
Contributor

jakemac53 commented Aug 27, 2018

Yes the only thing that works today is a totally different entrypoint, using dependency injection or something to provide the correct implementation for the platform.

I am working on support for this feature currently but its a little ways out still from landing.

@jakemac53
Copy link
Contributor

Ok, @valotas if you update to the latest build_modules/build_web_compilers/build_vm_compilers (likely just requires a pub upgrade), then this should now be supported.

Please file any issues if you have trouble!

@jakemac53
Copy link
Contributor

Do note though that at least for now you will have to add // ignore: uri_does_not_exist comments on your config specific imports, at least until dart-lang/sdk#34177 is resolved.

@jakemac53
Copy link
Contributor

Actually @natebosch made a good point that you are also using config specific exports, there is also an SDK issue for those (they don't work at all unfortunately, due to an analyzer issue). You can follow along at dart-lang/sdk#34179, as soon as it is fixed in the sdk there shouldn't be anything required on the build package side of things.

@valotas
Copy link
Author

valotas commented Sep 1, 2018

It looks like it works! Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants