StealJS 2.0 only contains 2 breaking changes, both of which are easy to upgrade.
The main is no longer automatically loaded
Previously when steal started up it would like your configuration (the configMain) and then load the main (usually the main property in your package.json). This makes it easy to get started using steal but makes things more difficult later when you have a larger application and use demo pages.
In StealJS 2.0 the main is no longer loaded automatically. Instead you can turn on automatic main loading by simply adding the main boolean attribute.
You can also explicitly set the main that you want to load such as main="~/app", the boolean main is a shortcut for the old behavior.
Promise polyfill
In StealJS 1.x a polyfill for Promise is included in steal.js and steal.production.js. Today Promises are supported natively in all modern browsers. In order to support Internet Explorer 11, however, you still need a Promise polyfill.
Change the steal script tag to point to steal-with-promises.js like so:
The following new features are turned on in StealJS 2.0. If you decide not to use them, you can opt out easily.
Tree shaking
StealJS now tree shakes modules, preventing unused dependencies from being loaded at all. This happens both in development (for faster page loads) and during the build (to minimize the amount of code included in your production bundles).
This is on by default. To turn the behavior off you can configure the loader. The package.json is the best place to do this:
Getting StealJS 2
The recommended way to get StealJS is using npm. If you’re not already using StealJS with npm, we recommend doing so. You can install with:
If you’re already using StealJS through npm, you can run the above commands to upgrade and your
package.json
will be updated.If you want to upgrade manually, change the versions of
steal
andsteal-tools
in yourpackage.json
to:Breaking changes
StealJS 2.0 only contains 2 breaking changes, both of which are easy to upgrade.
The main is no longer automatically loaded
Previously when steal started up it would like your configuration (the configMain) and then load the main (usually the
main
property in your package.json). This makes it easy to get started using steal but makes things more difficult later when you have a larger application and use demo pages.In StealJS 2.0 the main is no longer loaded automatically. Instead you can turn on automatic main loading by simply adding the
main
boolean attribute.Before
After
You can also explicitly set the main that you want to load such as
main="~/app"
, the boolean main is a shortcut for the old behavior.Promise polyfill
In StealJS 1.x a polyfill for Promise is included in steal.js and steal.production.js. Today Promises are supported natively in all modern browsers. In order to support Internet Explorer 11, however, you still need a Promise polyfill.
Change the steal script tag to point to steal-with-promises.js like so:
Before
After
New features
The following new features are turned on in StealJS 2.0. If you decide not to use them, you can opt out easily.
Tree shaking
StealJS now tree shakes modules, preventing unused dependencies from being loaded at all. This happens both in development (for faster page loads) and during the build (to minimize the amount of code included in your production bundles).
This is on by default. To turn the behavior off you can configure the loader. The package.json is the best place to do this: