webpack
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@types/eslint-scope | 3.7.7 | 2.09 kB | MIT | prod | |
@types/estree | 1.0.5 | 5.71 kB | MIT | prod | |
@webassemblyjs/ast | 1.11.6 | 21.73 kB | MIT | prod | |
@webassemblyjs/wasm-edit | 1.11.6 | 5.08 kB | MIT | prod | |
@webassemblyjs/wasm-parser | 1.11.6 | 12.72 kB | MIT | prod | |
acorn-import-assertions | 1.9.0 | 3.64 kB | MIT | prod | |
acorn | 8.11.2 | 122.43 kB | MIT | prod peer | |
browserslist | 4.22.1 | 15.19 kB | MIT | prod peer | 1 1 |
chrome-trace-event | 1.0.3 | 4.88 kB | MIT | prod | |
enhanced-resolve | 5.15.0 | 36.41 kB | MIT | prod | |
es-module-lexer | 1.4.1 | 27.91 kB | MIT | prod | |
eslint-scope | 5.1.1 | 16.33 kB | BSD-2-Clause | prod | |
events | 3.3.0 | 16.19 kB | MIT | prod | |
glob-to-regexp | 0.4.1 | 4.38 kB | BSD-2-Clause | prod | |
graceful-fs | 4.2.11 | 9.57 kB | ISC | prod | |
json-parse-even-better-errors | 2.3.1 | 4.45 kB | MIT | prod | |
loader-runner | 4.3.0 | 5.38 kB | MIT | prod | |
mime-types | 2.1.35 | 5.46 kB | MIT | prod | |
neo-async | 2.6.2 | 37.74 kB | MIT | prod | |
schema-utils | 3.3.0 | 17.93 kB | MIT | prod | |
tapable | 2.2.1 | 10.64 kB | MIT | prod | |
terser-webpack-plugin | 5.3.9 | 18.21 kB | MIT | prod | |
watchpack | 2.4.0 | 13.87 kB | MIT | prod | |
webpack-sources | 3.2.3 | 18 kB | MIT | prod |
Webpack is a powerful modular bundler for JavaScript that allows for the packaging of JavaScript files for use in the browser. It is capable of bundling, transforming, or packaging virtually any type of resource or asset. Webpack supports ECMA Script, CommonJS, and AMD modules making it flexible and convenient. It allows for code splitting which can significantly reduce initial loading time. It packs modules for the browser, enabling developers to split their codebase into multiple bundles that can be loaded on demand, enhancing performance.
To use webpack, you will first need to install it to your project as a development dependency. Webpack is typically installed using npm (Node Package Manager) or yarn.
Using npm, the installation command is:
npm install --save-dev webpack
Using yarn, the installation command is:
yarn add webpack --dev
Once installed, you can use webpack by creating a webpack.config.js
configuration file in your project root, and then simply running the webpack command in your terminal:
npx webpack
Here is a simple webpack configuration example:
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
}
};
This config tells webpack to take ./src/index.js
as the entry point to start building the dependency graph and to output the bundled result to ./dist/main.js
.
Webpack offers a rich set of loaders to preprocess files. Loaders are functions that take the source code as an input, process it, and return it as an output. They can be chained together and applied to a specific file type using a regex expression.
The official documentation for webpack can be found at [https://webpack.js.org