html scss编译css,javascript – SCSS文件没有编译成CSS使用Webpack做出反应

以下是我的文件夹结构& React项目的文件工作正常,但我无法使用extract-text-webpack-plugin通过Webpack通过SCSS添加CSS.让我知道我在配置上做错了什么.

文件夹结构 –

iavSA.png

Webpack.config.js文件 –

const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');

const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({

template: './app/index.html',filename: 'index.html',inject: 'body'

});

const ExtractTextPlugin = require('extract-text-webpack-plugin');

const ExtractTextPluginConfig = new ExtractTextPlugin('main.css',{

allChunks: true

});

module.exports = {

entry: './app/app.jsx',output: {

path: path.resolve('dist'),filename: 'bundle.js'

},devtool: 'source-map',module: {

loaders: [

{test: /.js$/,loader: 'babel-loader',exclude: /node_modules/},{test: /.jsx$/,{test: /\.scss$/,loader: ExtractTextPlugin.extract("style-loader","css-loader")}

]

},plugins: [HtmlWebpackPluginConfig,ExtractTextPluginConfig]

};

Package.json –

{

"name": "reactyarn","version": "1.0.0","main": "index.js","license": "MIT","scripts": {

"start": "webpack-dev-server --hot"

},"devDependencies": {

"babel-core": "^6.25.0","babel-loader": "^7.1.1","babel-preset-es2015": "^6.24.1","babel-preset-react": "^6.24.1","css-loader": "^0.28.4","extract-text-webpack-plugin": "^3.0.0","html-webpack-plugin": "^2.29.0","sass-loader": "^6.0.6","style-loader": "^0.18.2","webpack": "^3.3.0","webpack-dev-server": "^2.5.1"

},"dependencies": {

"path": "^0.12.7","react": "^15.6.1","react-dom": "^15.6.1"

}

}

仅供参考 –

我没有在控制台中收到任何JS错误,所以我相信它只是配置不起作用.

cwHLh.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值