其它选项(Other Options)

?> These are all the other options that might not need an entire page. Either we need to create new pages for them, move them to an existing page, or keep an Other Options section like this and replace this TODO with a short description/lead-in paragraph.

amd

object

设置 require.amddefine.amd 的值:

amd: {
  jQuery: true
}

某些流行的模块是按照 AMD 规范编写的,最引人瞩目的 jQuery 版本在 1.7.0 到 1.9.1,如果 loader 提示它对页面包含的多个版本采取了特殊许可时,才会注册为 AMD 模块。 许可权限是具有「限制指定版本注册」或「支持有不同定义模块的不同沙盒」的能力。

此选项允许将模块查找的键(key)设置为真值(truthy value)。 发生这种情况时,webpack 中的 AMD 支持将忽略定义的名称。

bail

boolean

在第一个错误出现时抛出失败结果,而不是容忍它。默认情况下,当使用 HMR 时,webpack 会将在终端以及浏览器控制台中,以红色文字记录这些错误,但仍然继续进行打包。要启用它:

bail: true

这将迫使 webpack 退出其打包过程。

cache

boolean object

缓存生成的 webpack 模块和 chunk,来改善构建速度。缓存默认在观察模式(watch mode)启用。禁用缓存只需简单传入:

cache: false

如果传递一个对象,webpack 将使用这个对象进行缓存。保持对此对象的引用,将可以在 compiler 调用之间共享同一缓存:

let SharedCache = {};

export default {
  ...,
  cache: SharedCache
}

不要在不同选项的调用之间共享缓存。

?> Elaborate on the warning and example - calls with different configuration options?

loader

object

在 loader 上下文中暴露自定义值。

?> Add an example...

profile

boolean

捕获一个应用程序"配置文件",包括统计和提示,然后可以使用 Analyze 分析工具进行详细分析。

使用 StatsPlugin 可以更好地控制生成的配置文件。

recordsPath

Description...

?> Add example and description as well as details on recordsInputPath and recordsOutputPath.

recordsInputPath

Description...

?> Add example and description as well as details on recordsInputPath and recordsOutputPath.

recordsOutputPath

Description...

?> Add example and description as well as details on recordsInputPath and recordsOutputPath.


原文:https://webpack.js.org/configuration/other-options/

results matching ""

    No results matching ""