Skip to content

Built-in dart2js transformer seems to run with '--categories=all' #1201

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

Closed
DartBot opened this issue Jun 5, 2015 · 4 comments
Closed

Built-in dart2js transformer seems to run with '--categories=all' #1201

DartBot opened this issue Jun 5, 2015 · 4 comments
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5757092?v=3" align="left" width="96" height="96"hspace="10"> Issue by mkustermann
Originally opened as dart-lang/sdk#21786


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.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/405837?v=3" align="left" width="48" height="48"hspace="10"> Comment by zoechi


Seems to be a dup of http://dartbug.com/21781
where 21781 is about not using --all in DartEditor by default anymore and this seems about also using -all from command line.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5757092?v=3" align="left" width="48" height="48"hspace="10"> Comment by mkustermann


This is orthogonal to Issue dart-lang/sdk#21781:

  • Issue Editor shouldn't run "pub build --all" sdk#21781 is about what directories to build (i.e. default behavior in DartEditor when selecting "Pub Build").
  • This issue is about passing the wrong flags to the $dart2js transformer (independent of directories).

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


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.

@DartBot DartBot added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jun 5, 2015
@nex3 nex3 added type-enhancement A request for a change that isn't a bug transformer and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Dec 9, 2015
@matanlurey matanlurey added the closed-not-planned Closed as we don't intend to take action on the reported issue label Mar 24, 2018
@matanlurey
Copy link
Contributor

We are no longer supporting transformers or pub serve/build going forward (this tooling has moved elsewhere into the https://github.com/dart-lang/build repository and https://github.com/dart-lang/webdev CLI) so a fix for this is not planned.

We'll be updating the tooling section of the Dart website in the coming weeks with more formal documentation on how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants