0
我試圖用青菜中的WebPack +反應,這是我的組件:如何配置webpack /反應的sass?
'use strict';
import React from 'react';
require('style.scss');
class App extends React.Component {
render() {
return (
<div className="hello-form"><p>this should be blue</p></div>
);
}
}
export default App;
這是我的配置設置:
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: ['babel'],
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}
]
當我運行的WebPack我收到此錯誤:
ERROR in ./App.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style.scss in C:\Users\d815694\WebstormProjects\reactfrom_scratch
@ ./App.js 24:0-24
如何使用webpack配置sass?
我們可以看到所有的webpack文件嗎? – EQuimper
你確定scss文件的路徑是正確的嗎?它應該與您的應用程序組件所在的路徑相關。 – dzv3
@ zv.diego它應該是require('./ style.scss');它正在工作,謝謝! –