Creating Your Application With Yarn

You’ll learn how to create your application using Yarn in this lesson.

We'll cover the following

Ember-CLI was made “Yarn-aware” with version 2.13 and has full support for the blazing-fast package manager. You can use Yarn from the get-go by passing an extra flag when you create your application.

So, go to the folder where you would like to store your ‘Rock ‘n’ Roll with Ember.js’ application and create a new Ember-CLI project passing the --yarn option:

ember new rarwe --no-welcome --yarn

A yarn.lock file will be created in your Ember project, and from this point on, all add-on installs will leverage yarn.

If you started your project using npm but want to switch to Yarn, just do

 yarn install

This creates the lockfile. Ember-CLI will detect you want to use Yarn and will comply.

You can read more about Yarn at https://yarnpkg.com/.

ES2015 modules

Ember-CLI uses Babel, which allows us to use the module definition syntax of the next version of JavaScript, ECMAScript 2015, ES2015, for short. These modules are transpiled to ES5, so they can be run in today’s browsers that do not yet fully support ES2015.

ES2015 stands for ECMAScript2105, a specification that introduced a whole slew of things that made JavaScript more powerful and a lot more fun to code in. One of the included features in ES2015 is the module system.

Each ES2015 module can export one or several things that other modules can import. These things are what the module shares with the outside world. Not being able to access things that are internal to the module is a good thing because it provides encapsulation and increases robustness. The simplest module exports one thing by defining a so-called “default export.” This is achieved by prefixing the thing-to-be-exported by the words export default:

Get hands-on with 1200+ tech skills courses.