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

pub serve - fails to see *.dart.js files and needs to include all of your assets #19828

Closed
DartBot opened this issue Jul 3, 2014 · 10 comments
Closed

Comments

@DartBot
Copy link

DartBot commented Jul 3, 2014

This issue was originally filed by to...@sonardesign.com


What steps will reproduce the problem?

  1. Do a pub serve with any HTML file in your web directory that also happens to link in another dart2js dart app (which would likely named *.dart.js - if not, ensure that it is)
  2. 404 on any .dart.js asset

What is the expected output? What do you see instead?

I'd expect my script.dart.js to be included in the pub serve web server. If I rename it and remove ".dart" it works. So the regex on the transformer I imagine sees .dart and excludes it?

What version of the product are you using? On what operating system?

1.5.1 OS X

Please provide any additional information below.

I really wish that pub serve would allow you to include ALL files in your web directory. It's not like it needs to include only those that it thinks you may be using...because first off it can't possibly know about all the assets I'm using from parsing the HTML file. There's async stuff going on, etc. Anyone using Angular.dart would easily run into issues due all of the partials being included. Second, who cares if it's including more assets than needed? Are you saving me bandwidth? On a local server? It doesn't matter. I don't see a need for optimization and if you believe anyone would ever think of using pub serve in production, you'll make me laugh =)

Seriously though, even if it was just a flag to pass that would include all the files...That would be awesome.

Thanks!

@dgrove
Copy link
Contributor

dgrove commented Jul 7, 2014

Added Area-Pub, Triaged labels.

@nex3
Copy link
Member

nex3 commented Jul 7, 2014

The behavior of automatically excluding .dart.js files was always intended to be temporary. Back when the editor didn't use pub build and pub serve, it generated .dart.js files in the web/ directory that caused collisions with the pub-generated versions. However, it hasn't generated those for a long time so it's probably time to remove that behavior.

@munificent
Copy link
Member

The Editor only switched to defaulting to pub serve recently, so I'm worried there are still a lot of .dart.js files sitting around in users' file systems.

Tom, a workaround here is to rename your pre-compiled file. Pub only filters out ".dart.js" files, so if you just rename it to ".js", it should work fine.

Keerti, at some point in the future, we'd like to remove this check in pub. Do you have any idea when you think it would be safe to do that?


cc @keertip.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@nex3
Copy link
Member

nex3 commented Jul 7, 2014

Added NeedsInfo label.

@munificent
Copy link
Member

We removed the "*.dart.js" check from pub a while back.


Added Fixed label.

@DartBot
Copy link
Author

DartBot commented Sep 25, 2014

This comment was originally written by to...@sonardesign.com


Cool. Thanks. It would also be awesome for pub serve to include everything too. It's completely unusable for things like Angular.dart because of all the asynchronous loading of template partials. I typically end up using Grunt and running my own server with Node.js or something, just to include anything not referenced in the main HTML file.

@munificent
Copy link
Member

It would also be awesome for pub serve to include everything too.

What is it not including that you're missing? Pub serve should serve almost everything now, as far as I know.

@DartBot
Copy link
Author

DartBot commented Sep 25, 2014

This comment was originally written by to...@sonardesign.com


I'll try again, but assets under "web/packages/..." were not available. So for example, HTML templates within the Angular.dart project held under there and referenced by the app would not be available.

@DartBot
Copy link
Author

DartBot commented Sep 25, 2014

This comment was originally written by to...@sonardesign.com


...and I assume this is because the HTML file under web did not reference the templates. Whereas an asset linked like CSS, JS, or an image, ie. "<link>" tag, would be included. I assumed this was due to a transformer running that looked for everything referenced in the HTML code with regex and included those assets only.

Again, I'm going to assume for some sort of efficiency in how many files were pulled into the web server that gets spawned by pub serve. Though I think that's a bit silly given we're just using pub serve locally right? Or is pub serve intended for some sort of production use case?

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/pub#1039.

This issue was closed.
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