日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

webpack为什么加载不了css?

發(fā)布時(shí)間:2025/7/25 60 豆豆
生活随笔 收集整理的這篇文章主要介紹了 webpack为什么加载不了css? 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

原文地址:?https://segmentfault.com/q/1010000005099261

?

這個(gè)app是用react寫的。

webpack的loader設(shè)置是這樣的

module:{loaders: [{test: /\.jsx?$/,exclude: /node_modules/,loader: 'babel',},{ test: '/\.css$/', loaders: ['style', 'css'],include: __dirname,},],},

  

也安裝了css-loader, style-loader

但當(dāng)加載css,import './stylesheets/all.css';
就會(huì)報(bào)錯(cuò):

./app/stylesheets/all.css Module parse failed: D:\FrontEnd\mzFM-web\app\stylesheets\all.css Unexpected token (1:11) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:11)

  

?

解決:

原來(lái)test:'/\.css$/'這里寫錯(cuò)了。 應(yīng)該是test:/\.css$/ 不帶''

  

?

轉(zhuǎn)載于:https://www.cnblogs.com/dfyg-xiaoxiao/p/6748416.html

總結(jié)

以上是生活随笔為你收集整理的webpack为什么加载不了css?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。