Closed liyongning closed 3 years ago
我试了手动引入对应组件的样式文件,因为我猜是因为这个路径后面没有 .css 后缀的问题。于是做了以下实验,在主文件中写:
import '@lyn/element-ui/lib/theme-chalk/button'; =》 有问题,提示上述错误 import '@lyn/element-ui/lib/theme-chalk/button.css'; =》 正确,没有问题
所以,请求,应该怎么配置,可以添加后缀吗?
配置没问题,需要给 webpack 添加 .css 的后缀,这样引入时就不需要添加写 .css 后缀了
{
chainWebpack: config => {
config.resolve.extensions.add('.css').end()
}
}
然后在主文件中按需引入,启动项目报错,提示找不到对应组件的 css 文件:
These dependencies were not found:
请问是我哪配的有问题吗?