[英]WebPack 2: Migrate preLoaders and postLoaders
I've installed webpack@2.1.0-beta.27
. 我已经安装了
webpack@2.1.0-beta.27
。 Before, I was using webpack@2.1.0-beta.22
. 之前,我使用的是
webpack@2.1.0-beta.22
。 On my configuration file I was using preLoaders
and postLoaders
: 在我的配置文件中,我使用的是
preLoaders
和postLoaders
:
preLoaders: [
{
test: /\.ts$/,
loader: 'string-replace-loader',
query: {
search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)',
flags: 'g'
},
include: [helpers.root('src')]
},
],
loaders: [...],
postLoaders: [
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
search: 'var sourceMappingUrl = extractSourceMappingUrl\\(cssText\\);',
replace: 'var sourceMappingUrl = "";',
flags: 'g'
}
}
]
I'm not able to figure out once I've took a look on internet how to migrate this preLoaders
and postLoaders
. 一旦我在互联网上看到如何迁移这个
preLoaders
和postLoaders
我就无法弄清楚了。
Should I put them inside loaders
? 我应该把它们放在
loaders
吗? Only that? 只有这样?
From v2.1-beta.23 the loaders section is renamed to rules and pre/postLoaders is now defined under each rule with the enforce
property. 从v2.1-beta.23开始,加载器部分被重命名为规则,现在在每个规则下使用
enforce
属性定义pre / postLoaders。
I've answered in more detail in this thread 我在这个帖子中已经详细回答了
More info can also be found in the release notes on github 更多信息也可以在github上的发行说明中找到
The release notes also mentions a migration example in the angular cli repo 发行说明还提到了角度cli repo中的迁移示例
Another tip is to look at the json schema that validates the config for hints. 另一个技巧是查看验证配置提示的json模式 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.