I am having a problem loading a css file in my react app configured from scratch using Typescript
. I have already added several packages to process the css files but none of them remove the error.
My webpack config:
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "typings-for-css-modules-loader",
options: {
modules: true,
namedExport: true,
camelCase: true
}
},
{
loader: "css-loader",
options: {
importLoaders: 1,
modules: true,
}
}
]
}
Any ideas?
After a lot of thought and a bit of confusion with typescript. For webpack configuration I just needed
style-loader
andcss-loader
Step 1: Required Packages
Step 2: Remove previously written error
Create file
declaration.d.ts
inside the folder./src
with the following content:That should remove the error and we'll be able to import our css file.