bundle your
assets scripts

STATIC ASSETS .png .css .jpg .js MODULES WITH DEPENDENCIES .jpg .png .sass .sass .js .sass .cjs .hbs .js

编写代码

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.

Ryan Helmoski's avatarDaiquiri.ioNoah Lemen's avatarAndor Polgar's avatar

白金赞助

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

trivago's avatar

金牌赞助

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

ag-Grid's avatarSegment's avatarAdobe's avatarCapital One's avatar

银牌赞助

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

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

铜牌赞助

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

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

赞助者