Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gitawego opened this issue Jun 19, 2015 · 22 comments · Fixed by #99
Closed

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

gitawego opened this issue Jun 19, 2015 · 22 comments · Fixed by #99

Comments

@gitawego
Copy link

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
Copy link
Author

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....

@lucianlature
Copy link

Confirmed.

@stevewillard
Copy link

Same issue here.

@chriserik
Copy link

The solution above works for me as well.

@bsr203
Copy link

bsr203 commented Jun 20, 2015

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

@schepelin
Copy link

Thanks! Your fix works for me

@harrisrobin
Copy link

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

@gitawego gitawego changed the title css-loader doesn't work anymore withe the v0.15.1 css-loader doesn't work anymore with v0.15.1 Jun 21, 2015
@phatshambler
Copy link

Same here, fix works.

@dreampulse
Copy link

I have the same problem..

@mmahalwy
Copy link

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)

@ninjasort
Copy link

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

@pthorn
Copy link

pthorn commented Jun 23, 2015

Same here. Reverted to 0.14.5.

@qimingweng
Copy link

+1 0.15 breaks for me, downgraded to 0.14

@ruifortes
Copy link

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

@maslianok
Copy link

+1 same issue

@mhuggins
Copy link

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

justin808 added a commit to shakacode/bootstrap-sass-loader-example that referenced this issue Jul 5, 2015
* Note, css-loader only updated to 0.14.5 per this discussion:
* webpack-contrib/css-loader#84
@gitawego
Copy link
Author

gitawego commented Jul 8, 2015

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

@rlucha
Copy link

rlucha commented Jul 10, 2015

+1, same here

@Wicus
Copy link

Wicus commented Jul 12, 2015

yes same issue

@minhtranite
Copy link

+1 same issue

@jblack10101
Copy link

+1 same here

markdalgleish added a commit that referenced this issue Jul 13, 2015
@markdalgleish
Copy link
Contributor

This issue should now be fixed in v0.15.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.