MCPcopy
hub / github.com/webpack/webpack

github.com/webpack/webpack @v5.108.3 sqlite

repository ↗ · DeepWiki ↗ · release v5.108.3 ↗
10,458 symbols 34,775 edges 9,768 files 3,387 documented · 32%
README

[![npm][npm]][npm-url]

[![node][node]][node-url] [![builds1][builds1]][builds1-url] [![dependency-review][dependency-review]][dependency-review-url] [![coverage][cover]][cover-url] pkg.pr.new [![PR's welcome][prs]][prs-url] compatibility-score downloads install-size backers sponsors contributors discussions discord LFX Health Score

webpack

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 just about any resource or asset.

Table of Contents

Install

Install with npm:

npm install --save-dev webpack

Install with yarn:

yarn add webpack --dev

Introduction

Webpack is a bundler for modules. The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

TL;DR

  • Bundles ES Modules, CommonJS, and AMD modules (even combined).
  • Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time).
  • Dependencies are resolved during compilation, reducing the runtime size.
  • Loaders can preprocess files while compiling, e.g. TypeScript to JavaScript, Handlebars strings to compiled functions, images to Base64, etc.
  • Highly modular plugin system to do whatever else your application requires.

Learn about webpack through videos!

Get Started

Check out webpack's quick Get Started guide and the other guides.

Browser Compatibility

Webpack supports all browsers that are ES5-compliant (IE8 and below are not supported). Webpack also needs Promise for import() and require.ensure(). If you want to support older browsers, you will need to load a polyfill before using these expressions.

Concepts

Plugins

Webpack has a rich plugin interface. Most of the features within webpack itself use this plugin interface. This makes webpack very flexible.

Name Status Install Size Description
mini-css-extract-plugin mini-css-npm mini-css-size Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS.
compression-webpack-plugin compression-npm compression-size Prepares compressed versions of assets to serve them with Content-Encoding
html-bundler-webpack-plugin bundler-npm bundler-size Renders a template (EJS, Handlebars, Pug) with referenced source asset files into HTML.
html-webpack-plugin html-plugin-npm html-plugin-size Simplifies creation of HTML files (index.html) to serve your bundles
pug-plugin pug-plugin-npm pug-plugin-size Renders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug.

Loaders

Webpack enables the use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.js.

Loaders are activated by using loadername! prefixes in require() statements, or are automatically applied via regex from your webpack configuration.

JSON

Name Status Install Size Description
cson-npm cson-size Loads and transpiles a CSON file

Transpiling

Name Status Install Size Description
babel-npm babel-size Loads ES2015+ code and transpiles to ES5 using Babel
type-npm type-size Loads TypeScript like JavaScript
coffee-npm coffee-size Loads CoffeeScript like JavaScript

Templating

Name Status Install Size Description
html-npm html-size Exports HTML as string, requires references to static resources
pug-npm pug-size Compiles Pug to a function or HTML string, useful for use with Vue, React, Angular
md-npm md-size Compiles Markdown to HTML
posthtml-npm posthtml-size Loads and transforms a HTML file using PostHTML
hbs-npm hbs-size Compiles Handlebars to HTML

Styling

| Name | Status | Install Siz

Extension points exported contracts — how you extend this code

ApplyOptions (Interface)
(no doc)
module.d.ts
Matchers (Interface)
(no doc)
declarations.test.d.ts
Process (Interface)
(no doc)
declarations.d.ts
Abortable (Interface)
(no doc)
types.d.ts
NormalModuleLoaderContext (Interface)
(no doc)
declarations/LoaderContext.d.ts
WebpackOptions (Interface)
(no doc)
declarations/WebpackOptions.d.ts
WatchIgnorePluginOptions (Interface)
(no doc)
declarations/plugins/WatchIgnorePlugin.d.ts
OtherSomeInterface (Interface)
(no doc)
test/configCases/typescript/type-only-imports/mixed.ts

Core symbols most depended-on inside this repo

require
called by 3762
test/cases/parsing/extract-require/index.js
push
called by 2883
lib/css/CssParser.js
tap
called by 1281
lib/ProgressPlugin.js
add
called by 865
lib/util/LazySet.js
set
called by 865
lib/util/StackedMap.js
resolve
called by 714
module.d.ts
slice
called by 687
lib/dependencies/HarmonyExportImportedSpecifierDependency.js
callback
called by 687
test/MultiItemCache.unittest.js

Shape

Method 3,906
Function 3,779
Class 2,135
Interface 636
Enum 2

Languages

TypeScript100%

Modules by API surface

types.d.ts800 symbols
lib/javascript/JavascriptParser.js182 symbols
lib/index.js143 symbols
lib/FileSystemInfo.js125 symbols
lib/Compilation.js119 symbols
lib/ChunkGraph.js117 symbols
lib/css/syntax.js108 symbols
test/configCases/inner-graph/issue-11678/module.js106 symbols
lib/html/syntax.js106 symbols
test/statsCases/track-returned/index.js90 symbols
lib/ExportsInfo.js82 symbols
schemas/WebpackOptions.check.js81 symbols

Dependencies from manifests, versioned

@babel/core8.0.1 · 1×
@babel/preset-react8.0.1 · 1×
@changesets/cli2.29.8 · 1×
@changesets/get-github-info0.8.0 · 1×
@codspeed/core5.5.0 · 1×
@scoped/package* · 1×
@types/convert-source-map2.0.3 · 1×
@types/eslint-scope3.7.7 · 1×
@types/estree1.0.8 · 1×
@types/graceful-fs4.1.9 · 1×
@types/jest30.0.0 · 1×
@types/json-schema7.0.15 · 1×

Datastores touched

my_dbDatabase · 1 repos

For agents

$ claude mcp add webpack \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact