Skip to content
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

Broken sourcemap path #666

Closed
kyle-ssg opened this issue Feb 18, 2019 · 11 comments
Closed

Broken sourcemap path #666

kyle-ssg opened this issue Feb 18, 2019 · 11 comments

Comments

@kyle-ssg
Copy link

kyle-ssg commented Feb 18, 2019

  • Operating System: OSX High Sierra
  • Node Version: 10.x
  • NPM Version: v9.8.0
  • webpack Version: 6.4.1
  • sass-loader Version: 7.1.0

Expected Behavior

Given a file located at /Users/kyle/project/web/styles/components/_stat-card.scss I would expect the sourcemap path to be maintained.

Actual Behavior

Sourcemap outputs a path of /Users/kyle/project/web/styles/web/styles/components/_stat-card.scss

https://github.com/kyle-ssg/sass-loader-bug

Results in:

I was able to temporarily get around this by doing the following in loader.js:

 result.map.sources = result.map.sources.map((p)=>{
                return "file://"+process.cwd()+"/"+path.normalize(p)
            });
@kyle-ssg
Copy link
Author

Seems similar to #460

@alexander-akait
Copy link
Member

@kyle-ssg don't use gist for reproducible test repo, please create repo with source code, because in some places node-sass have bugs with source maps and it is hard to reproduce

@kyle-ssg
Copy link
Author

@evilebottnawi Sure. Created a minimal repo that replicates the issue.

@alexander-akait
Copy link
Member

@kyle-ssg what is command you use when you have invalid source map? I see you use Extract Text Webpack Plugin, he is outdated, you need use mini-css-webpack-plugin for extract css.

@kyle-ssg
Copy link
Author

kyle-ssg commented Mar 2, 2019

npm run dev

The sourcemap if you hover over the path in chrome points to /web/web

@alexander-akait
Copy link
Member

@kyle-ssg do you test this on linux?

@kyle-ssg
Copy link
Author

kyle-ssg commented Mar 4, 2019

Nope, osx. The source map does show the scss but the path is wrong, so you can’t edit and save file from chrome.

@alexander-akait
Copy link
Member

@kyle-ssg can't reproduce on osx, what do you mean "path is wrong"? Anyway i will look this problem in near future, feel free to investigate and send a PR

@kyle-ssg
Copy link
Author

kyle-ssg commented Mar 4, 2019 via email

@alexander-akait
Copy link
Member

Reproduce bug, similar problem webpack-contrib/css-loader#652, investigate who is broken

@alexander-akait
Copy link
Member

Yep, duplicate webpack-contrib/css-loader#652, sass-loader output right source map

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

No branches or pull requests

2 participants