简体   繁体   English

在React应用程序中将select的css文件导入库时,我不断收到错误

[英]I am continuously getting a error when importing css file of the select to library in a react app

I am using select2 library in my react app to add some drop downs. 我在我的应用程序中使用select2库来添加一些下拉列表。 When i am importing the css file it gives a error saying "you may need a appropriate loader to handle this file type". 当我导入css文件时,出现错误消息“您可能需要适当的加载程序来处理此文件类型”。 so how can fix this error. 那么如何解决此错误。 In my project i am using SCSS to style my components. 在我的项目中,我正在使用SCSS设置组件样式。

picture of the error 错误图片

My loader in webpack.config.js is like this 我在webpack.config.js中的加载器是这样的

{
  test: /\.scss$/,
  loader: 'style-loader!css-loader!sass-loader'
}

You can add another loader right before your scss loader 您可以在scss加载器之前添加另一个加载器

{
  test: /\.css$/,
  loader: 'style-loader!css-loader'
},
{
  test: /\.scss$/,
  loader: 'style-loader!css-loader!scss-loader'
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 react 中导入文件时出现错误 - while importing file in react I am getting an error 创建新的 React 应用程序时出现错误 - I am getting an error when creating a new react app 使用 npx 创建 React 应用程序时出现错误 - i am getting an error when creating a react app using npx 在 React.JS 中导入时尝试使用常量时出错 - Getting error when i am trying to use constant when importing in React.JS 为什么我通过导入 react-chartjs-2 得到运行时错误 - why am I getting a runtime error by importing react-chartjs-2 当我在 Github 上部署我的 React 应用程序时出现此错误“错误:“行”不是已注册的 controller。” - I am getting this error when I deployed my React app on Github "Error: "line" is not a registered controller." React,Sass,从.scss文件导入img时出错 - React, Sass, getting an error when importing img from a .scss file 当我用 Provider 包装我的应用程序组件时,为什么会出现此错误? Redux 和 React Native - Why am I getting this error when I wrapped my App component with Provider? Redux and React Native 我在制作新的反应时遇到错误 - 本机应用程序 - I am getting an error when i was making a new react - native app 将CSS文件导入到特定组件React App - Importing css file to specific component react app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM