Questions tagged [css-loader]

css loader module for webpack

450 questions
53
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 Taylor
  • 8,894
  • 15
  • 59
  • 85
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,660
  • 2
  • 25
  • 32
30
votes
8 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
  • 827
  • 1
  • 9
  • 15
23
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
  • 5,646
  • 3
  • 27
  • 78
22
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
  • 22,870
  • 34
  • 131
  • 236
18
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,386
  • 4
  • 21
  • 44
15
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 { …
rgvtim
  • 415
  • 1
  • 3
  • 11
14
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…
acui145
  • 525
  • 1
  • 4
  • 8
14
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
  • 17,405
  • 18
  • 82
  • 100
13
votes
6 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…
12
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
  • 3,585
  • 2
  • 29
  • 40
12
votes
6 answers

cannot find module css-loader while doing ng build -prod with angular-cli@1.0.0-beta.21

I have following package.json configuration "dependencies": { "@angular/common": "2.2.1", "@angular/compiler": "2.2.1", "@angular/core": "2.2.1", "@angular/forms": "2.2.1", "@angular/http": "2.2.1", "@angular/platform-browser":…
Gan
  • 853
  • 7
  • 19
11
votes
3 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
  • 4,901
  • 5
  • 31
  • 62
11
votes
2 answers

webpack fails "module build failed: unknown word" with webpack.config.js file

webpack does not work for me when trying to add css using the css-loader. os: Windows 10 pro, webpack: 4.8.0 node: 8.9.4 npm: 6.0.0 css-loader: 0.28.11 style-loader: 0.21.0 package.json { "name": "webpack-dev", "version": "1.0.0", …
rochin
  • 111
  • 1
  • 1
  • 4
11
votes
1 answer

Using css modules with Extract Text Plugin

Webpack 2 build doesn't work as expected in production mode using css modules option in css-loader with extract-text-webpack-plugin. the correct generated classes are created on html elements, implying that css-loader is working as intended, but the…
1
2 3
29 30