vue 2.0
我觉得是个坑。。。
以swiper为例,先看下报错情况
#引入
import Swiper from "swiper"
import 'swiper/dist/css/swiper.css'
#配置
{
test: /\.css/,
loader: "style-loader!css-loader",
},
ERROR Failed to compile with 1 errors15:48:43
This dependency was not found:
* swiper/dist/css/swiper.css in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/slider.vue
To install it, you can run: npm install --save swiper/dist/css/swiper.css
虽然不知道为什么,但是如果在配置文件里加
{
test: /\.css/,
loader: "style-loader!css-loader",
include: [] #加这一句
},
然后一切都正常了,阳光明媚,春暖花开
网友评论