webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph which maps every module your project needs and generates one or more bundles.
started you only need to understand its Core Concepts:
Entry
entry point indicates which module webpack should use to begin building out its internal dependency graph. webpack will figure out which other modules and libraries that entry point depends on (directly and indirectly).
By default its value is
./src/index.js
, but you can specify a different (or multiple entry points) by configuring the entry property in the webpack configuration.
The output property tells webpack where to emit the bundles it creates and how to name these files. It defaults to
./dist/main.js
for the main output file and to the ./dist
folder for any other generated file.
Loaders
webpack only understands JavaScript and JSON files. Loaders allow webpack to process other types of files and convert them into valid modules that can be consumed by your application and added to the dependency graph.
Plugins
At its core, webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph which maps every module your project needs and generates one or more bundles.
Browser Compatibility
webpack supports all browsers that are ES5-compliant (IE8 and below are not supported). webpack needs
Promise
for import()
and require.ensure()
. If you want to support older browsers, you will need to load a polyfillbefore using these expressions.Mode
By setting the
mode
parameter to either development
, production
or none
, you can enable webpack's built-in optimizations that correspond to each environment. The default value is production
.https://webpack.js.org/concepts/
No comments:
Post a Comment