网页 综合 更新时间 2026-11-14 05:11:47

Configuration | webpack

自动蜘蛛 webpack.js.org 正文约 1992 字
Configuration | webpack
Out of the box, webpack won't require you to use a configuration file. However, it will assume the entry point of your project is src/index.js and will output the result in dist/main.js minified and optimized for production.
Usually, your projects will need to extend this functionality, for this you can create a webpack.config.js file in the root folder and webpack will automatically use it.
All the available configuration options are specified below.
New to webpack? Check out our guide to some of webpack's core concepts to get started!
If for some reason you want to use a different configuration file depending on certain situations, you can change this via command line by using the --config flag.
webpack applies configuration defaults after plugins defaults are applied.
Webpack has a huge set of options which might be overwhelming to you, please take advantage of webpack-cli starting from version v6.0.0 new tool create-webpack-app which could rapidly generate webpack application with specific configuration files for your project requirements, it will ask you a couple of questions before creating a configuration file.
npx might prompt you to install create-webpack-app if it is not yet installed in the project or globally. You might also get additional packages installed to your project depending on the choices you've made during the new webpack application generation.
Copyright OpenJS Foundation and webpack contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy
访问原文 返回搜索 https://webpack.js.org/configuration/
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。