Questions tagged [css-loader]

css loader module for webpack

516 questions
9
votes
1 answer

How to debug CSS bundled by Webpack?

I've switched from including stylesheets the oldschool way: to Webpack approach: var css = require('./../css/main.css'); It works, but I don't like that it extracts the css from this file into…
van_folmert
  • 4,257
  • 10
  • 44
  • 89
8
votes
1 answer

Bug with css-loader / style-loader

I'm having a problem that is happening to me in two differentes PC's. For my project I've installed for development the following dependencies: (webpack webpack-cli @babel/core @babel/preset-env @babel/preset-react babel-loader css-loader…
8
votes
1 answer

Use [hash:base64:5] in JavaScript / TypeScript file

I am using CSS Modules in an Angular Project with Webpack. I had already transformed the class names in .css and .scss files with postcss-modules. Then with posthtml-css-modules I had changed the values on the class property in html elements for his…
German Quinteros
  • 1,870
  • 9
  • 33
8
votes
2 answers

Cannot import CSS module in .tsx file

I am building basic react application with typescript but I am not able to import CSS file in index.tsx file I am able to import index.css file following way: import './index.css'; //this import gives typescript error when running webpack but not…
AviatorX
  • 492
  • 1
  • 7
  • 17
8
votes
1 answer

Invalid Property Value on css style using imported css file in react

I am trying to style a React Component. To achieve this, I am importing a css file and using className such as indicated in ReactJs Documentation. I have added a css-loader + style-loader to my webpack.config.js file as described below : const path…
Jaro
  • 1,587
  • 5
  • 20
  • 39
8
votes
5 answers

How to skip Javascript output in Webpack 4?

I use Webpack 4 in a project where I only need to compile and bundle styles so far. There's no Javascript. Here's the config I have: const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = { …
rishat
  • 8,206
  • 4
  • 44
  • 69
8
votes
2 answers

How to remove all comments with CSS Loader with webpack 2 in string mode?

I use this config for my webpack 2 { test: /\.css$/i, use: ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) } How to remove all comments based on string mode ? I use this…
HamedFathi
  • 3,667
  • 5
  • 32
  • 72
8
votes
1 answer

How to use @font-face with webpack's css-loader?

I'm trying to import some font (like Roboto) in my project using webpack but none of them works. My file structure looks like this: +-src---fonts-+-Roboto---Roboto.ttf | | | +-fonts.css | +-webpack.config.js My fonts.css…
EnixCoda
  • 339
  • 3
  • 7
7
votes
1 answer

Error importing CSS modules with Storybook webpack 5

I am using Storybook with webpack 5 for a simple project and I'm having challenges with CSS module imports despite customising the webpack config for storybook. (2:7) src/stories/header.css Unknown word 1 | > 2 | import API from…
Ikem O
  • 79
  • 1
  • 4
7
votes
1 answer

Can we make Webpack ignore the image files if not found on file system?

Thanks in Advance. I have the below webpack config, { test: /\.scss$/, use: extractPlugin.extract({ use: [ { loader: 'css-loader', options: { minimize: true …
Vinay thallam
  • 391
  • 1
  • 7
  • 17
7
votes
3 answers

Using postcss-loader after css-loader

I am using CSS modules with webpack css-loader, then I bundle them with mini-css-extract-plugin. Here is how my config looks like: { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, { loader: "css-loader", …
Grundiss
  • 153
  • 9
7
votes
1 answer

Webpack@4.0.0: "Module parse failed. You may need an appropriate loader to handle this file type" - though using css-loader and style-loader

Below is my webpack.config.js and the package.json module.exports = { entry: "./entry.js", output: { filename: "./build/js/bundle.js" }, module: { rules: [ { test: /.\js$/, use: [ { …
Imran
  • 121
  • 1
  • 1
  • 7
7
votes
1 answer

Why is style-loader included in my production bundle?

I have a minimal webpack setup and using sass, css and style loaders to compile sass in my project. Everything works fine but I can't understand why when I run webpack -p I get some style-loader functions in my bundle: As you can see node-modules…
ciaoben
  • 3,138
  • 4
  • 27
  • 42
7
votes
3 answers

Media Query not working with CSS/Style loader and Webpack3

I am using css-loader and style-loader for my CSS but all media queries are not working. I am using "webpack": "^3.4.1", "css-loader": "^0.28.4" and "style-loader": "^0.18.2". This is my Webpack configuration: const ExtractTextPlugin =…
7
votes
1 answer

Is css-loader neccessary if you use postcss-loader with appropriate plugins?

I'm using postcss-import to take care of my imports, and cssnano to minify. In my Webpack config I've been using the following setup for css-loader... { loader: 'css-loader', options: { url: false, import: false, minimize: false, …
1 2
3
34 35