BREAKING CHANGE: dart.js bootstrap file is moving to pub

834 views
Skip to first unread message

Vijay Menon

unread,
Jan 11, 2013, 7:46:12 PM1/11/13
to General Dart Discussion
FYI: We are moving the bootstrap file dart.js to pub.  Please update any links to dart.js from your html files accordingly.  

We will delete the old copy of dart.js in our repository in a couple weeks.

The dart.js file is used in Dart browser apps to check for native Dart support and either (a) bootstrap Dartium or (b) load compiled JS instead.  Previously, we've recommended that you add a script tag pointing the version of dart.js in our repository.  This doesn't work offline and also results in slower startup (see dartbug.com/6723).

Instead, we now recommend that you install dart.js via the following steps:

1. Add the following to your pubspec.yaml:
  dependencies:
    browser: any

2. Run pub install.

3. Use a relative script tag in your html to the installed version:

<script src="packages/browser/dart.js"></script>

If you do not wish to use pub, you may host a copy of this file locally instead.  In this case, you will need to update it yourself as necessary.  We reserve the right to move this file in the repository, so we no longer recommend linking to it directly.

Seth Ladd

unread,
Jan 12, 2013, 6:06:23 PM1/12/13
to General Dart Discussion
Hi Dartisans,

This is really important. If you write any browser based apps today, you should immediately follow Vijay's advice. This new browser package is in pub today: http://pub.dartlang.org/packages/browser

Looking forward to your feedback!

Thanks,
Seth


--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
 
 

Don Olmstead

unread,
Jan 12, 2013, 7:20:17 PM1/12/13
to mi...@dartlang.org
Glad to hear this change was made. Been bitten by dart.js before when trying to do a demo which Seth can attest to ;)

Alan Frye

unread,
Jan 12, 2013, 8:04:16 PM1/12/13
to mi...@dartlang.org

So if  you are behind a corporate proxy server then pub will not work and you will have to host the file yourself.

Rico Wind

unread,
Jan 14, 2013, 1:50:35 AM1/14/13
to General Dart Discussion
Alan: Yes for now, there is a few issues that needs to be resolved before pub will work correctly behind proxies:

Cheers,
Rico

Moises Belchin

unread,
Jan 14, 2013, 3:19:31 AM1/14/13
to General Dart Discussion
Hi all,

It's the first time I'm going to use Pub, now with this breaking change, how many often I'll need to do Pub Update command?

Thanks and regards.


Saludos.
Moisés Belchín.


2013/1/14 Rico Wind <ri...@google.com>

Bob Nystrom

unread,
Jan 14, 2013, 6:32:25 PM1/14/13
to General Dart Discussion

On Mon, Jan 14, 2013 at 12:19 AM, Moises Belchin <moises...@gmail.com> wrote:
It's the first time I'm going to use Pub, now with this breaking change, how many often I'll need to do Pub Update command?

You'll want to run pub install anytime:

1. You change the dependencies in your pubspec.yaml.
2. You add a new directory inside your package that contains Dart entrypoints. (In other words, if you add bin/, example/, test/, too/, web/, or a subdirectory in any of those.)

If you're running it only because (2), then it should completely quickly and won't hit the network. It's just setting up some symlinks.

You'll want to run pub update anytime:

1. You specifically want to upgrade to the latest version of some dependency.

You'll only run pub update when you decide you want your app to move forward and use a different version of some dependency.

Cheers!

- bob


Dominic Hamon

unread,
Jan 22, 2013, 1:45:44 PM1/22/13
to General Dart Discussion
Does this mean that live demos (http://dartbox2d.googlecode.com/git/demos.html) would no longer work unless the dart.js is checked in under that path?

Is there any danger when checking in a file under 'packages'?

On Fri, Jan 11, 2013 at 4:46 PM, Vijay Menon <v...@google.com> wrote:

--

Bob Nystrom

unread,
Jan 22, 2013, 5:30:28 PM1/22/13
to General Dart Discussion
On Tue, Jan 22, 2013 at 10:45 AM, Dominic Hamon <dom...@google.com> wrote:
Does this mean that live demos (http://dartbox2d.googlecode.com/git/demos.html) would no longer work unless the dart.js is checked in under that path?

It depends on how you hosted that demo. How is the "packages" directory set up for that? How did you deal with the symlinks in there?
 

Is there any danger when checking in a file under 'packages'?

Depends on what you mean by "danger". :)

Pub expects to be able to control that directory, so if you run a pub command on that package, it will replace the contents of that directory. If you're OK with that, then it's fine.

This is definitely understood to be an awkward corner of pub right now. We're hoping a deploy step and "path:" dependencies will make this less painful.

- bob

Dominic Hamon

unread,
Jan 22, 2013, 5:50:41 PM1/22/13
to General Dart Discussion
On Tue, Jan 22, 2013 at 2:30 PM, Bob Nystrom <rnys...@google.com> wrote:

On Tue, Jan 22, 2013 at 10:45 AM, Dominic Hamon <dom...@google.com> wrote:
Does this mean that live demos (http://dartbox2d.googlecode.com/git/demos.html) would no longer work unless the dart.js is checked in under that path?

It depends on how you hosted that demo. How is the "packages" directory set up for that? How did you deal with the symlinks in there?

This is running directly from the git repo. Right now, the demos don't have any package dependencies (though this will change in the future... dartvectormath is coming Snoo).

 
 

Is there any danger when checking in a file under 'packages'?

Depends on what you mean by "danger". :)

Pub expects to be able to control that directory, so if you run a pub command on that package, it will replace the contents of that directory. If you're OK with that, then it's fine.

I don't have an issue with the directory being replaced but if dart.js is checked in, I'll be checking in a new version and essentially locally-hosting it. Do you see any issue with that?

 

This is definitely understood to be an awkward corner of pub right now. We're hoping a deploy step and "path:" dependencies will make this less painful.

- bob

--

Vijay Menon

unread,
Jan 22, 2013, 6:06:34 PM1/22/13
to General Dart Discussion
On Tue, Jan 22, 2013 at 2:50 PM, Dominic Hamon <dom...@google.com> wrote:


On Tue, Jan 22, 2013 at 2:30 PM, Bob Nystrom <rnys...@google.com> wrote:

On Tue, Jan 22, 2013 at 10:45 AM, Dominic Hamon <dom...@google.com> wrote:
Does this mean that live demos (http://dartbox2d.googlecode.com/git/demos.html) would no longer work unless the dart.js is checked in under that path?

It depends on how you hosted that demo. How is the "packages" directory set up for that? How did you deal with the symlinks in there?

This is running directly from the git repo. Right now, the demos don't have any package dependencies (though this will change in the future... dartvectormath is coming Snoo).

 
 

Is there any danger when checking in a file under 'packages'?

Depends on what you mean by "danger". :)

Pub expects to be able to control that directory, so if you run a pub command on that package, it will replace the contents of that directory. If you're OK with that, then it's fine.

I don't have an issue with the directory being replaced but if dart.js is checked in, I'll be checking in a new version and essentially locally-hosting it. Do you see any issue with that?

That's reasonable for now, but you may need to update it in the future.  Since you are planning on using pub packages anyway, you'll probably want to switch to using the browser package at some point.

Dominic Hamon

unread,
Jan 22, 2013, 6:46:38 PM1/22/13
to General Dart Discussion
On Tue, Jan 22, 2013 at 3:06 PM, Vijay Menon <v...@google.com> wrote:



On Tue, Jan 22, 2013 at 2:50 PM, Dominic Hamon <dom...@google.com> wrote:


On Tue, Jan 22, 2013 at 2:30 PM, Bob Nystrom <rnys...@google.com> wrote:

On Tue, Jan 22, 2013 at 10:45 AM, Dominic Hamon <dom...@google.com> wrote:
Does this mean that live demos (http://dartbox2d.googlecode.com/git/demos.html) would no longer work unless the dart.js is checked in under that path?

It depends on how you hosted that demo. How is the "packages" directory set up for that? How did you deal with the symlinks in there?

This is running directly from the git repo. Right now, the demos don't have any package dependencies (though this will change in the future... dartvectormath is coming Snoo).

 
 

Is there any danger when checking in a file under 'packages'?

Depends on what you mean by "danger". :)

Pub expects to be able to control that directory, so if you run a pub command on that package, it will replace the contents of that directory. If you're OK with that, then it's fine.

I don't have an issue with the directory being replaced but if dart.js is checked in, I'll be checking in a new version and essentially locally-hosting it. Do you see any issue with that?

That's reasonable for now, but you may need to update it in the future.  Since you are planning on using pub packages anyway, you'll probably want to switch to using the browser package at some point.

To be clear - I will be using the browser package, but i'll also be checking the dart.js in from the packages folder to allow the live demos to still run.

Nick DaGreek

unread,
Jun 27, 2014, 8:05:20 PM6/27/14
to mi...@dartlang.org
I've followed the instructions outlined here, and yet none of my applications will run anymore.
I get the following error .message ..

'Failed to load resource: the server responded with a status of 404 (Not Found)

http://127.0.0.1:8080/packages/browser/dart.js'


Any suggestions?

I even tried to to create a new project, won't run, same error?


Justin Fagnani

unread,
Jun 27, 2014, 10:42:50 PM6/27/14
to General Dart Discussion
A new project with a current Dart Editor won't run, because of that error? Very strange. This change happened a year and a half ago.

My only thought is that you don't have the browser package installed. Check your pubspec.yaml and run pub get.

Hope that helps,
  Justin



--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Reply all
Reply to author
Forward
0 new messages