Webpack is a module bundler, which is used to deploy JavaScript-based applications. It takes the input as modules with dependencies and then outputs these into static assets.
From the Webpack documentation site (https://webpack.github.io/docs/what-is-webpack.html#how-is-webpack-different), the following image explains the same.
As in the earlier chapters, let's build a simple React-based application with which we will be integrating the Webpack and deploy thereafter.
Install the packages vis npm
from a terminal as:
sudo npm install babel-loader babel-preset-es2015 babel-preset-react babel-preset-stage-2 npm -g install httpster
Note
httpster
: It is a simple http server to run the static content. In chrome browser, the index.html
file sometimes doesn't render due to the X-origin error. Hence, running this webserver from your application directory will be easier to test your application in Chrome. Just run the command httpster
.
By default...