Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

License

NotificationsYou must be signed in to change notification settings

webpack/webpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



npm

nodebuilds1builds2dependency-reviewcoveragePR's welcomecompatibility-scoredownloadsinstall-sizebackerssponsorscontributorsdiscussionsdiscord

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 JavaScriptfiles for usage in a browser, yet it is also capable of transforming, bundling,or packaging just about any resource or asset.

TL;DR

  • BundlesES Modules,CommonJS, andAMD 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 quickGet Started guide and theother guides.

Browser Compatibility

Webpack supports all browsers that areES5-compliant (IE8 and below are not supported).Webpack also needsPromise forimport() andrequire.ensure(). If you want to support older browsers, you will need toload a polyfill before using these expressions.

Concepts

Webpack has arich plugininterface. Most of the featureswithin webpack itself use this plugin interface. This makes webpack veryflexible.

NameStatusInstall SizeDescription
mini-css-extract-pluginmini-css-npmmini-css-sizeExtracts CSS into separate files. It creates a CSS file per JS file which contains CSS.
compression-webpack-plugincompression-npmcompression-sizePrepares compressed versions of assets to serve them with Content-Encoding
html-webpack-pluginhtml-plugin-npmhtml-plugin-sizeSimplifies creation of HTML files (index.html) to serve your bundles
pug-pluginpug-plugin-npmpug-plugin-sizeRenders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug.

Webpack enables the use of loaders to preprocess files. This allows you to bundleany static resource way beyond JavaScript. You can easilywrite your ownloaders using Node.js.

Loaders are activated by usingloadername! prefixes inrequire() statements,or are automatically applied via regex from your webpack configuration.

Files

NameStatusInstall SizeDescription
val-loaderval-npmval-sizeExecutes code as module and considers exports as JS code

JSON

NameStatusInstall SizeDescription
cson-npmcson-sizeLoads and transpiles a CSON file

Transpiling

NameStatusInstall SizeDescription
babel-npmbabel-sizeLoads ES2015+ code and transpiles to ES5 usingBabel
type-npmtype-sizeLoads TypeScript like JavaScript
coffee-npmcoffee-sizeLoads CoffeeScript like JavaScript

Templating

NameStatusInstall SizeDescription
html-npmhtml-sizeExports HTML as string, requires references to static resources
pug-npmpug-sizeLoads Pug templates and returns a function
pug3-npmpug3-sizeCompiles Pug to a function or HTML string, useful for use with Vue, React, Angular
md-npmmd-sizeCompiles Markdown to HTML
posthtml-npmposthtml-sizeLoads and transforms a HTML file usingPostHTML
hbs-npmhbs-sizeCompiles Handlebars to HTML

Styling

NameStatusInstall SizeDescription
<style>style-npmstyle-sizeAdd exports of a module as style to DOM
css-npmcss-sizeLoads CSS file with resolved imports and returns CSS code
less-npmless-sizeLoads and compiles a LESS file
sass-npmsass-sizeLoads and compiles a Sass/SCSS file
stylus-npmstylus-sizeLoads and compiles a Stylus file
postcss-npmpostcss-sizeLoads and transforms a CSS/SSS file usingPostCSS

Frameworks

NameStatusInstall SizeDescription
vue-npmvue-sizeLoads and compiles Vue Components
polymer-npmpolymer-sizeProcess HTML & CSS with preprocessor of choice andrequire() Web Components like first-class modules
angular-npmangular-sizeLoads and compiles Angular 2 Components
riot-npmriot-sizeRiot official webpack loader
svelte-npmsvelte-sizeOfficial Svelte loader

Performance

Webpack uses async I/O and has multiple caching levels. This makes webpack fastand incrediblyfast on incremental compilations.

Module Formats

Webpack supports ES2015+, CommonJS and AMD modulesout of the box. It performs clever staticanalysis on the AST of your code. It even has an evaluation engine to evaluatesimple expressions. This allows you tosupport most existing libraries out of the box.

Webpack allows you to split your codebase into multiple chunks. Chunks areloaded asynchronously at runtime. This reduces the initial loading time.

Webpack can do many optimizations toreduce the output size of yourJavaScript by deduplicating frequently used modules, minifying, and givingyou full control of what is loaded initially and what is loaded at runtimethrough code splitting. It can also make your code chunkscachefriendly by using hashes.

Contributing

We want contributing to webpack to be fun, enjoyable, and educational for anyone, and everyone. We have avibrant ecosystem that spans beyond this single repo. We welcome you to check out any of the repositories inour organization orwebpack-contrib organization which houses all of our loaders and plugins.

Contributions go far beyond pull requests and commits. Although we love giving you the opportunity to put your stamp on webpack, we also are thrilled to receive a variety of other contributions including:

To get started have a look at ourdocumentation on contributing.

Creating your own plugins and loaders

If you create a loader or plugin, we would <3 for you to open source it, and put it on npm. We follow thex-loader,x-webpack-plugin naming convention.

Support

We consider webpack to be a low-level tool used not only individually but also layered beneath other awesome tools. Because of its flexibility, webpack isn't always theeasiest entry-level solution, however we do believe it is the most powerful. That said, we're always looking for ways to improve and simplify the tool without compromising functionality. If you have any ideas on ways to accomplish this, we're all ears!

If you're just getting started, take a look atour new docs and concepts page. This has a high level overview that is great for beginners!!

If you have discovered a 🐜 or have a feature suggestion, feel free to create an issue on GitHub.

Current project members

For information about the governance of the Node.js project, seeGOVERNANCE.md.

TSC (Technical Steering Committee)

Core Collaborators

Sponsoring

Most of the core team members, webpack contributors and contributors in the ecosystem do this open source work in their free time. If you use webpack for a serious task, and you'd like us to invest more time on it, please donate. This project increases your income/productivity too. It makes development and applications faster and it reduces the required bandwidth.

This is how we use the donations:

  • Allow the core team to work on webpack
  • Thank contributors if they invested a large amount of time in contributing
  • Support projects in the ecosystem that are of great value for users
  • Support projects that are voted most (work in progress)
  • Infrastructure cost
  • Fees for money handling

Premium Partners

Other Backers and Sponsors

Before we started using OpenCollective, donations were made anonymously. Now that we have made the switch, we would like to acknowledge these sponsors (and the ones who continue to donate using OpenCollective). If we've missed someone, please send us a PR, and we'll add you to this list.

Gold Sponsors

Become a gold sponsor and get your logo on our README on GitHub with a link to your site.

Silver Sponsors

Become a silver sponsor and get your logo on our README on GitHub with a link to your site.

Bronze Sponsors

Become a bronze sponsor and get your logo on our README on GitHub with a link to your site.

Backers

Become a backer and get your image on our README on GitHub with a link to your site.

Special Thanks to

(In chronological order)

  • @google forGoogle Web Toolkit (GWT), which aims to compile Java to JavaScript. It features a similarCode Splitting as webpack.
  • @medikoo formodules-webmake, which is a similar project. webpack was born because of the desire for code splitting for modules such as Webmake. Interestingly, theCode Splitting issue is still open (thanks also to @Phoscur for the discussion).
  • @substack forbrowserify, which is a similar project and source for many ideas.
  • @jrburke forrequire.js, which is a similar project and source for many ideas.
  • @defunctzombie for thebrowser-field spec, which makes modules available for node.js, browserify and webpack.
  • @sokra for creating webpack.
  • Every early webpack user, which contributed to webpack by writing issues or PRs. You influenced the direction.
  • All past and current webpack maintainers and collaborators.
  • Everyone who has written a loader for webpack. You are the ecosystem...
  • Everyone not mentioned here but that has also influenced webpack.

About

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project


    [8]ページ先頭

    ©2009-2025 Movatter.jp