Giter Club home page Giter Club logo

webpack-babel-boilerplate's Introduction

Steps to create this boilerplate as like below:

You can use common js modular pattern (used by Node js internal) and ES6 modular pattern as well.

Some workflow tools - webpack, gulp, grunt etc.

Webpack is to fix the issues as like huge coding on one file, debugging issue, multiple scripts (single responsibility principal), multiple request handling in index.html file, bandwidth loss, slowing the application

Webpack- module bundler (bundle multiple js file to single file) https://webpack.js.org/

Main file - main.js/app.js/script.js (anyone) Dependency file - UI.js, Store.js, weather.js, or any related js file (altogether)

Babel - Convert the latest code into the older version code so that both of old and modern browsers can read the code and execute well

JavaScript compiler - (next generation code to ES5) https://babeljs.io/

How to install webpack on project folder https://webpack.js.org/guides/getting-started/ npm init -y npm install webpack webpack-cli --save-dev

Install babel under webpack https://webpack.js.org/loaders/ https://webpack.js.org/loaders/babel-loader/ npm install -D babel-loader @babel/core @babel/preset-env webpack - (webpack (not needed))

babel documentation https://babeljs.io/docs/en/babel-preset-env @babel/preset-env is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, browser polyfills) are needed by your target environment(s). Latest code is transformed to ES5 or any old version code

create index.html Create src folder -> index.js create webpack.config.js (name must be) Use js common modular pattern require path .... webpack generates build folder automatically

Method 1. Babel loaders - write some rules on webpack.config.js https://webpack.js.org/loaders/babel-loader/#usage for multiple script js files loading and converting next generation code into ES5

Method 2. For async await converting support, use polyfill https://webpack.js.org/guides/shimming/#loading-polyfills

Method 3. For server creating use webpack dev server https://webpack.js.org/guides/development/#using-webpack-dev-server https://webpack.js.org/configuration/dev-server/#devserverpublicpath-

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.