Questions tagged [css-loader]

css loader module for webpack

516 questions
82
votes
3 answers

Import CSS from "node_modules" in Webpack

Some third-party modules I'm using have their own CSS files. I'd like to include them in my app's one, single CSS file, which is processed by Webpack. How can CSS files under "node_modules" be imported into my CSS file? For example, I'm using the…
Donald T
  • 10,234
  • 17
  • 63
  • 91
37
votes
9 answers

Webpack - background images not loading

I'm fairly new to webpack but having some problems with css-loader or file-loader. I'm trying to load a background-image but it doesn't work quite right. The background-image isn't shown, even though the devtools show the background-image style.…
Eric
  • 917
  • 2
  • 9
  • 16
31
votes
3 answers

Webpack extract-text-webpack-plugin and css-loader minification

I am having problem minimizing the css file output by the extract-text-webpack-plugin /* webpack.config.js */ ... loader: [{test: /\.css$/, loader: ExtractTextPlugin.extract('css?minimize')}] ... plugins: [new…
Green
  • 4,950
  • 3
  • 27
  • 34
26
votes
3 answers

css-loader localIdentName: is a hash necessary for uniqueness?

The css-loader README suggests that localIdentName be set to '[path][name]__[local]--[hash:base64:5]' Is the hashing suffix necessary? Would it still be unique as this? '[path][name]__[local]' Why or why not? The fact that #3 is an option in this…
Scotty H
  • 6,432
  • 6
  • 41
  • 94
25
votes
7 answers

Webpack style-loader / css-loader: url() path resolution not working

There are a few SO posts about style-loader and css-loader, but despite this I have not been able to find a solution to my problem. In short summary, when I @import css files in other css files, and the imported css contains url()s with relative…
Magnus
  • 6,791
  • 8
  • 53
  • 84
24
votes
2 answers

Sourcemaps with webpack css-loader

I am struggling to get sourcemaps working with css-loader. Output in console: What the documentation from css-loader says: SourceMaps To include SourceMaps set the sourceMap query param. require("css-loader?sourceMap!./file.css") My…
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
22
votes
7 answers

CSS error source-map information is not available at URL() declaration (found orphan CR, try removeCR option)

I am having a problem when I execute NPM start in my project. I get this error message: ./src/assets/base.scss…
22
votes
1 answer

Module not found: Error: Can't resolve 'css-loader'

I'm using css-loader and get following error: ERROR in ./src/pages/home/index.js Module not found: Error: Can't resolve 'css-loader' in '/Users/jian/Documents/sina/webpack-barbarian-test' @ ./src/pages/home/index.js 2:0-20 @ multi…
Jian Cui
  • 745
  • 1
  • 5
  • 10
21
votes
4 answers

“You may need an appropriate loader to handle this file type” with Webpack and CSS

I an new to webpack, and I have been able to get it to packup my javascript, but the CSS eludes me. I keep getting a: “You may need an appropriate loader to handle this file type” One the first line of my css file. The CSS file is simple: body { …
TexasNeo
  • 592
  • 1
  • 3
  • 12
20
votes
2 answers

css-loader not importing .css file returning empty object

Importing style from css files. Returning empty object. Seems css-loader is not working correctly. Can anyone help me on this. Please find the reference files below index.js import React from 'react' import style from…
Gopinath Shiva
  • 3,822
  • 5
  • 25
  • 48
19
votes
1 answer

Css Loader vs Style Loader Vs Sass-Loader

I was little confused in differentiating sass-loader and css-loader while using import statement. As per my knowledge css loader resolve import statment(@import) and style-loader works on injecting style dynamically on your page. I am also using…
Bharat Sewani
  • 628
  • 2
  • 10
  • 18
18
votes
4 answers

CSS Loader has been initialised using an options object that does not match the API schema

Production build fails with the following error: ValidationError: Invalid options object. CSS Loader has been initialised using an options object that does not match the API schema. - options has an unknown property 'minimize'. These properties are…
Alexander Kim
  • 17,304
  • 23
  • 100
  • 157
17
votes
1 answer

Webpack not building because CssSyntaxError

I am trying to run a webpack-dev-server built, but it fails everytime with the following error: ERROR in ./src/style.css…
user4787241
16
votes
3 answers

Module not found: Error: Can't resolve './style.css' in Directory?

I am trying to run the command npm run build but it is not working. and I am getting the error below: > typescript@1.0.0 build /Users/Prashant/Code/typescript > webpack Hash: c6dbd1eb3357da70ca81 Version: webpack 3.2.0 Time: 477ms Asset …
Prashant Barve
  • 4,105
  • 2
  • 33
  • 42
16
votes
1 answer

using css modules in react how can I pass a className as a prop to a component

If I have a react component and I want to pass in a className, how do I do this with CSS Modules. It currently just gives the className but not the hash generated css module name which I would get for
svnm
  • 22,878
  • 21
  • 90
  • 105
1
2 3
34 35