2016-11-17 150 views
18

我已經安裝[email protected]。之前,我使用的是[email protected]。在我的配置文件我用preLoaderspostLoadersWebPack 2:遷移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' 
     } 
    } 
    ] 

我無法找出一旦我接過來一看互聯網上如何遷移這個preLoaderspostLoaders

我應該把它們放進loaders嗎?只有這樣?

回答

29

從v2.1-beta.23開始,裝載程序部分重命名爲規則,現在在每個規則下使用enforce屬性定義了pre/postLoaders。

我已經回答了更詳細的this thread

更多信息,也可在release notes在github上找到

該版本還注意到角CLI回購

另一個祕訣提到了migration example是看json schema驗證提示的配置。