Yarn + Babel demo
In new apps the support for Yarn will be added using the --yarn option:
rails new todo --yarn
This install the dependencies defined by default in
package.json for new apps, right now this include
Also is possible to install the dependencies defined in package.json in an existing app:
To add new dependencies just use
yarn add command:
yarn add angular
You can add a specify version of dependencies in the command:
yarn add angular@^1.5.8
To delete an unused dependency use the
yarn remove command:
yarn remove jquery-ujs
The dependencies installed by Yarn can be used in Sprockets as long as they work exporting browser globals (most of the dependencies for browsers do this already), if you want to use CommonJS/AMD dependencies you need to have a CommonJS/AMD environment for Sprockets or a bundler like Webpack or Browserify.
For more info about Yarn read the Getting Started guide.
Sprockets detects that babel-transpiler is included as dependency and register the Babel processor for .es6 files.
By default Babel transpiles ES2015 modules to CommonJS modules hence you will need a CommonJS environment for Sprockets or a bundler like Webpack or Browserify if you want to use ES2015 modules.
Check Babel docs to get more info about ES2015.