Creating a Javascript deployment set from Dart2js output
Asked Answered
R

3

3

After developing an alpha version of a Dart-based web application, I'm interested in testing the Dart2js deployment potentials of my app. However, it doesn't seem there is a "clean" way of creating a JS deployment version of the app - the dart2js code outputs stuff to the out directory, but there is other Dart stuff in there too. It seems things reference back to the web parent directory, and then there are all the packages references. I thought of copying all the stuff in out to a separate directory, but that doesn't seem to work.

Is there a clean way to create a deployment of the Javascript version of a Dart app?

Thanks in advance,

-D

Relate answered 28/2, 2013 at 19:1 Comment(0)
V
5

This is one of the joy's of living on the bleeding edge...

Check out this answer: what could be a deployment strategy with pubspec on dart

Another issue to track on the web ui project is:

(Basically, you're waiting for the pub deploy command to be created)

Update: Dartbug 6006 is being worked on at the moment, and says that it work like the following:

It'll copy everything in "web" into a deploy directory, run dart2dart and dart2js on all the entrypoints, and clean up the Dart source files. This will produce a directory that can be served without any additional steps.

Vicky answered 28/2, 2013 at 20:31 Comment(3)
Roger that on the bleeding edge comment. True joy shall be had by all... The bigger question is when is the pub deploy command supposed to be available? The smaller question is what steps would normally be involved in that process? If I knew those, I could somewhat work around a lot of this, at least in order to me my demo deadlines until pub deploy is ready.... Thanks for the heads up on that other article.Relate
For the moment, it might be worth just deploying your web/ folder (including the /out). I've also updated the answer above to include the bug to track on the web_ui project.Vicky
I tried deploying my whole web/ folder, it doesn't seem to work :(Glacial
A
0

Just tried doing so.

The following steps should work:

  1. Create a Run Configuration. Be sure to use the html in the out directory as the target.
  2. Generate all necessary files (the JS, CSS, etc)
  3. Copy the all files in out directory to somewhere you want (your web site, for example).
  4. Change the supporting file locations in the html file. In particular, css, and the script src="packages/browser/dart.js"

Now you can directly run by double clicking the html file and/or launch it in the web server.

Acnode answered 5/10, 2013 at 11:37 Comment(0)
C
0

Did you try: http://pub.dartlang.org/doc/pub-build.html

Use pub build when you’re ready to deploy your web app. When you run pub build, it generates the assets for the current package and all of its dependencies, putting them into a new directory named build.

Castigate answered 6/1, 2014 at 17:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.