在 webpack 中使用加载器时,使用“-loader”后缀引用加载器有什么不同吗?

When using loaders with webpack, are there any differences in referring to the loader with the "-loader" postfix?

我见过不同的例子,比如这两个:

  1. An example showing the "-loader" postfix after the style and css loaders,

  2. Another including the loaders without the "-loader" postfix.

我已经测试过了,似乎在这两种情况下都有效。 webpack 是否测试并包含它?

没有区别。

过去这是有问题的。如果您同时安装了 css and css-loader,则在使用 loader: 'css' 类型的定义时可能无法加载。这似乎不再是问题。

如果需要,

resolveLoader.moduleTemplates 可用于详细控制此行为。