-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Built-in dart2js transformer seems to run with '--categories=all' #21786
Comments
This comment was originally written by @zoechi Seems to be a dup of http://dartbug.com/21781 |
This is orthogonal to Issue #21781:
|
We can probably use a better category for stuff in web/ and bin/. The tricky part is example/, test/, benchmark/ and other user-defined directories. Any of those could contain web stuff or command-line stuff, so we have to use category all. |
This issue has been moved to dart-lang/pub#1201. |
This can be highly confusing for users who accidentally import 'dart:io' in a web application.
$ cat pubspec.yaml
name: foo
version: 0.1.0
$ cat web/foo.dart
import 'dart:io';
import 'dart:html';
main() {
query('#foobar');
stdout.writeln('hello world');
}
$ pub build
Loading source assets...
Building foo...
[Info from Dart2JS]:
Compiling foo|web/foo.dart...
[Info from Dart2JS]:
Took 0:00:05.293322 to compile foo|web/foo.dart.
Built 1 file to "build".
=> It compiles without any warning or error!
Whereas if I run dart2js manually it gives me a proper error message:
$ dart2js web/foo.dart
web/foo.dart:1:8:
Error: Library not found 'dart:io'.
import 'dart:io';
^^^^^^^^^
Error: Compilation failed.
I'm not sure if this is intentionally or not, but e.g. for automated scripts which run "pub build" and check for successful building of the application, this can hide errors IMHO.
We should give users warnings/errors as early as possible and never suppress them by default.
The text was updated successfully, but these errors were encountered: