配置
通常,你的项目还需要继续扩展此能力,为此你可以在项目根目录下创建一个 文件,webpack 会自动使用它。
下面指定了所有可用的配置选项。
注意整个配置中我们使用 Node 内置的 path 模块,并在它前面加上 这个全局变量。可以防止不同操作系统之间的文件路径问题,并且可以使相对路径按照预期工作。更多「POSIX 和 Windows」的相关信息请查看此章节。
webpack.config.js
If for some reason you want to use custom configuration file depending on certain situations you can change this via command line by using the --config
flag.
Want to rapidly generate webpack configuration file for your project requirements with just a few clicks away?
is an interactive portal you can play around by selecting custom webpack configuration options tailored for your frontend project. It automatically generates a minimal webpack configuration based on your selection of loaders/plugins, etc.
Visual tool for creating webpack configs is an online configuration tool for creating webpack configuration file where you can select any combination of features you need. It also generates a full example project based on your webpack configs.