bundle your
assets scripts

dependency bundling graphic

编写代码

app.js

import bar from './bar';

bar();

bar.js

export default function bar() {
  //
}

使用 webpack 打包

webpack.config.js

module.exports = {
  entry: './app.js',
  output: {
    filename: 'bundle.js'
  }
};

page.html

<html>
  <head>
    ...
  </head>
  <body>
    ...
    <script src="bundle.js"></script>
  </body>
</html>

然后在命令行运行 webpack 就会创建 bundle.js

让一切变得简单

立即开始更多关于 webpack 核心概念的高级信息,请通过快速查阅指南部分,或深入概念部分来了解。

支持团队

通过你的贡献、捐款或者赞助,webpack 将获得繁荣发展。你的捐助直接用于支持我们付出工作、持续改进,最加重要的是有助于我们提供优秀的文档和资料!

近期赞助

The following persons/organizations made their first donation in the last 14 days.

KeyCDN's avatarFreegames66.com's avatarEirik Birkeland's avatarCucumber LimitedJarrod DavisPrince Bechani's avatar

平台赞助

platinum sponsorsare those who have pledged $50,000 or more to webpack.

金牌赞助

gold sponsorsare those who have pledged $10,000 to $50,000 to webpack.

trivago's avatarSegment's avatarag-Grid's avatarAdobe's avatarCapital One's avatar

银牌赞助

silver sponsorsare those who have pledged $2,000 to $10,000 to webpack.

Slack's avatarTipe.io's avatarKeyCDN's avataregghead.io's avatarPeerigon's avatarGoogle Angular's avatar上线了's avatarWebflow's avatar5 minutes of React podcast's avatarFacebook Open Source's avatar

铜牌赞助

bronze sponsorsare those who have pledged $200 to $2,000 to webpack.

Sentry.io's avatarVTEX's avatarFrontend Masters's avatarX-Team's avatarPhotoEditorSDK's avatarJared Palmer's avatarSebastian Software GmbH's avatarKent C. Dodds's avatarWaffle.io's avatarAlligator.io's avatarAddy Osmani's avatarZEIT's avatarAirbnb's avatarRollbar's avatarSarah Drasner's avatarSticker Mule's avatarsynedra IT GmbH's avatarHubSpot's avatarAccelebrate's avatarYvo Schaap's avatarIcons8's avatarSoftwarePlant's avatarAndrew Lunny's avatarN26's avatarModus Create's avatarClevertech's avatarJoshua Wiens's avatarAppfolio's avatarThe Training Advisors's avatarProductReview.com.au's avatarEsben Petersen's avatarclay's avatarAviture Inc.'s avatarCerner Engineering 's avatarreBuy's avatarAlgolia's avatarThreadless ShopIrvin Waldman's avatarChristian Alfoni's avatarDan Abramov's avatarWork & Co's avatarJetRuby Agency's avatarArchitects.ioReact Native Training's avatarBen Vinegar's avatarWonmin's avatarI Done This's avatarEvgeny Rodionov's avatar

赞助者