#Babel and webpack
Babel is Javacsript compiler.
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging ##
In this unit, you modify the existing application and use some new ECMAScript 6 features. You then set up a build environment using Babel and Webpack.
Step 1: using new ECMAScript 6 Features
in app.js with arrow functions and let %!#$!#
Step 2: Setup Babel and Webpack
install webpack and babel
in folder create webpack.config.js:
1 | var path = require('path'); |
Step 4:
package.json in your favorite code editor. In the scripts section, add a script named webpack that builds your application using Webpack and Babel. The scripts section should now look like this:
1 | "scripts": { |
- Create build folder to the compile version of the application
1
The build process will fail if you don’t create the build directory
Step next: Build and Run
- npm run webpack
open index.html modified the