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
Comments
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. |
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. |
Added NeedsInfo label. |
We removed the "*.dart.js" check from pub a while back. Added Fixed label. |
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. |
What is it not including that you're missing? Pub serve should serve almost everything now, as far as I know. |
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. |
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? |
This issue has been moved to dart-lang/pub#1039. |
This issue was originally filed by to...@sonardesign.com
What steps will reproduce the problem?
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!
The text was updated successfully, but these errors were encountered: