css-loader icon indicating copy to clipboard operation
css-loader copied to clipboard

css-loader doesn't work anymore with v0.15.1

Open gitawego opened this issue 11 years ago • 22 comments

after updated to v0.15.1 from v0.14.x, css loader doesn't work any more. error1

here is the config:

const sassLoaders = [
  "css",
  "sass?" + ["outputStyle=expanded",
    "includePaths[]=" + nodeModulesPath,
    "includePaths[]=" + bowerComponentsPath].join("&")
].join("!");

later on

{
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract("style-loader", sassLoaders, {
          publicPath: './'
        })

      },

gitawego avatar Jun 19 '15 08:06 gitawego

I've noticed in file /node_modules/css-loader/lib/processCss.js, wether I use sourcemap or not, the variable inputMap is always string null.. and it crashes postcss.

var result = pipeline.process(inputSource, {
        from: options.from,
        to: options.to,
        map: {
            prev: inputMap,
            sourcesContent: true,
            inline: false,
            annotation: false
        }
    });

so the final way I do for now is modify file /node_modules/css-loader/lib/loader.js, at line 17, detect if map is not null before stringify it

if(map && typeof map !== "string") {
        map = JSON.stringify(map);
    }

with this hack, it works without map....

gitawego avatar Jun 19 '15 08:06 gitawego

Confirmed.

lucianlature avatar Jun 19 '15 13:06 lucianlature

Same issue here.

stevewillard avatar Jun 19 '15 14:06 stevewillard

The solution above works for me as well.

chriserik avatar Jun 19 '15 20:06 chriserik

same issue. Here is my stack (slightly different)

ERROR in /usr/local/lib/~/css-loader!/usr/local/lib/~/sass-loader?outputStyle=expanded!./src/client/style/index.scss
Module build failed: TypeError: Cannot read property 'sections' of null
    at new SourceMapConsumer (/usr/local/lib/node_modules/css-loader/node_modules/postcss/node_modules/source-map/lib/source-map/source-map-consumer.js:23:21)
    at PreviousMap.consumer (/usr/local/lib/node_modules/css-loader/node_modules/postcss/lib/previous-map.js:37:34)
    at new Input (/usr/local/lib/node_modules/css-loader/node_modules/postcss/lib/input.js:42:28)
    at parse (/usr/local/lib/node_modules/css-loader/node_modules/postcss/lib/parse.js:17:17)
    at new LazyResult (/usr/local/lib/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:54:47)
    at Processor.process (/usr/local/lib/node_modules/css-loader/node_modules/postcss/lib/processor.js:30:16)
    at processCss (/usr/local/lib/node_modules/css-loader/lib/processCss.js:168:24)
    at Object.module.exports (/usr/local/lib/node_modules/css-loader/lib/loader.js:21:15)
 @ ./src/client/style/index.scss 4:14-225 13:2-17:4 14:20-231

bsr203 avatar Jun 20 '15 13:06 bsr203

Thanks! Your fix works for me

schepelin avatar Jun 20 '15 15:06 schepelin

Confirmed. I simply downgraded to 0.14x instead of modifying library code.

harrisrobin avatar Jun 20 '15 21:06 harrisrobin

Same here, fix works.

phatshambler avatar Jun 21 '15 16:06 phatshambler

I have the same problem..

dreampulse avatar Jun 22 '15 16:06 dreampulse

same here. I get it from extract-text-plugin which requires any latest version.

ERROR in ./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader!./~/sass-loader?outputStyle=expanded!./~/bootstrap-sass-loader/bootstrap-sass-styles.loader.js!./bootstrap-sass.config.js
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'sections' of null
    at new SourceMapConsumer (/quran/node_modules/css-loader/node_modules/postcss/node_modules/source-map/lib/source-map/source-map-consumer.js:23:21)
    at PreviousMap.consumer (/quran/node_modules/css-loader/node_modules/postcss/lib/previous-map.js:37:34)
    at new Input (/quran/node_modules/css-loader/node_modules/postcss/lib/input.js:42:28)
    at Object.parse [as default] (/quran/node_modules/css-loader/node_modules/postcss/lib/parse.js:17:17)
    at new LazyResult (/quran/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:54:42)

mmahalwy avatar Jun 22 '15 20:06 mmahalwy

0.14x works for me. Been debugging this all day.. : - (

ninjasort avatar Jun 23 '15 01:06 ninjasort

Same here. Reverted to 0.14.5.

pthorn avatar Jun 23 '15 12:06 pthorn

+1 0.15 breaks for me, downgraded to 0.14

qimingweng avatar Jun 25 '15 14:06 qimingweng

also adding sourceMap parameter seems to work see here http://stackoverflow.com/questions/30932592/sass-loader-not-working-in-webpack

ruifortes avatar Jun 28 '15 23:06 ruifortes

+1 same issue

maslianok avatar Jun 29 '15 11:06 maslianok

+1, downgrading the dependency to "~1.4.0" fixed the issue for me.

mhuggins avatar Jun 30 '15 05:06 mhuggins

new version (v0.15.2) still has this problem.....

gitawego avatar Jul 08 '15 14:07 gitawego

+1, same here

rlucha avatar Jul 10 '15 10:07 rlucha

yes same issue

Wicus avatar Jul 12 '15 07:07 Wicus

+1 same issue

minhtranite avatar Jul 12 '15 14:07 minhtranite