2017-04-04 83 views
0

我試圖更新到webpack 2,並且我陷入了後CSS加載階段。這裏是我的相關代碼:Webpack引發POSTCSS錯誤的配置錯誤

{ 
     test: /\.scss$/, 
     loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!postcss-loader!sass-loader?outputStyle=expanded&sourceComments=true'}), 
     exclude: /\/custom-apps\/|future/ 
    }, 
    { 
     test: /\.scss$/, 
     loader: 'style-loader!css-loader?modules&localIdentName=[local]___[hash:base64:5]&importLoaders=2!postcss-loader!sass-loader?outputStyle=expanded&sourceComments=true', 
     include: /\/custom-apps\/|future/ 
    }, 

的錯誤,我得到:

PostCSS Config could not be loaded. Please check your PostCSS Config.

回答

0

在項目的根路徑

postcss.config.js

添加本地文件的內容:

module.exports = { 
    importLoaders: 1, 
}; 

爲我做了。

在我的示例代碼中,也把 !postcss-loader?importLoaders: 1我認爲應該工作。