By liran bh | 1/4/2017 | JavaScript

ES6 build Environment

To create a build environment for javascript you can use many tools, IDEs, Editors. In this post I list required tools and where to find it.

 

 

1. Node.JS - install latest version

 

Update npm using:

npm install npm –g

 

 

2. Babel.js - create a new directory and run the following commands (using node command prompt or shell with configured path)

npm init
npm install --save-dev babel-cli
npm install babel-preset-es2015 --save-dev

create directories for src,lib  

update the package.json file to add the build command run:

{
  "name": "es2015",
  "version": "1.0.0",
  "description": "sample",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build":"babel src -d lib"
  },
  "keywords": [
    "es2015"
  ],
  "author": "liran",
  "license": "MIT",
  "devDependencies": {
    "babel-cli": "^6.22.2",
    "babel-preset-es2015": "^6.22.0"
  }
}

Add .babelrc file (note the leading dot) with the following:

{
  "presets": ["es2015"]
}

To build the code run:

npm run build

Now you can see the result on the lib directory 

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Recent Stories

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
3220
Mendy Bennett
Experienced with Ad network & Ad servers.
Mobile | Ad Networks and 1 more
View Profile
User photo
3060
Karen Fitzgerald
7 years in Cross-Platform development.
Mobile | Cross Platform Frameworks
View Profile
Show All
X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now