webpack-contrib / stylus-loader

:art: A stylus loader for webpack.
MIT License
498 stars 99 forks source link

Sourcemap not working #287

Closed laggingreflex closed 4 years ago

laggingreflex commented 4 years ago

Just upgraded to v4. It seems sourcemap isn't working.

I'm enabling it using devtool: 'source-map'. I've also tried {options: {sourceMap: true }}. Either way results in an error.

Repro: https://github.com/laggingreflex/repro-stylus-loader-4-sourcemap

I cloned stylus-loader locally and ran the tests which failed on my system (Windows 10) but seems to pass when I ran under WSL (Ubuntu). But running repro under WSL still failed.

Expected Behavior

Should work with sourcemap enabled

Actual Behavior

Gives error

ERROR in ./src/style.styl (./node_modules/css-loader/dist/cjs.js!C:/.../stylus-loader/dist/cjs.js!./src/style.styl)
Module build failed (from C:/.../stylus-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'C:\...\style.styl'
 @ ./src/style.styl 2:26-141
 @ ./src/index.js

Code

// webpack.config.js
{
  devtool: 'source-map', // <- causes the error
  module: {
    rules: [{
      test: /\.styl$/,
      use: ['style-loader', 'css-loader', 'stylus-loader']
    }]
  }
}

How Do We Reproduce?

Repro: https://github.com/laggingreflex/repro-stylus-loader-4-sourcemap

cap-Bernardito commented 4 years ago

@laggingreflex Thanks for your feedback and PR. We'll be making changes soon.