You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
sourcemap doesn't work as expected with css-modules #738
What is the current behavior?
With sourceMap and modules both enabled, the soucemaps don't seem to work as expected. The source that shows in the browser's dev tools is the JavaScript, not the actual CSS.
If the current behavior is a bug, please provide the steps to reproduce.
I created this repository to minimally reproduce this issue.
What is the expected behavior?
I'd expect to see the actual CSS from the source files (perhaps with generated class names).
Please mention other relevant information such as your webpack version, Node.js version and Operating System.
I've tested this on Ubuntu 16.04 and MacOS (whatever the latest version is).
node: 8.11.1
webpack: 4.14.0
importReactfrom'react';importstylesfrom'./button.css';exportdefaultfunctionButton(){return(<buttontype="button"className={styles.root}>{'I am a button!'}</button>);}
varcontent=require("!!../../node_modules/css-loader/index.js??ref--5-1!./button.css");if(typeofcontent==='string')content=[[module.id,content,'']];vartransform;varinsertInto;varoptions={"sourceMap":true,"hmr":true}options.transform=transformoptions.insertInto=undefined;varupdate=require("!../../node_modules/style-loader/lib/addStyles.js")(content,options);if(content.locals)module.exports=content.locals;if(module.hot){module.hot.accept("!!../../node_modules/css-loader/index.js??ref--5-1!./button.css",function(){varnewContent=require("!!../../node_modules/css-loader/index.js??ref--5-1!./button.css");if(typeofnewContent==='string')newContent=[[module.id,newContent,'']];varlocals=(function(a,b){varkey,idx=0;for(keyina){if(!b||a[key]!==b[key])returnfalse;idx++;}for(keyinb)idx--;returnidx===0;}(content.locals,newContent.locals));if(!locals)thrownewError('Aborting CSS HMR due to changed css-modules locals.');update(newContent);});module.hot.dispose(function(){update();});}
Whereas I'd expect to see the original CSS source, not the JavaScript used to load it.
Activity
hexpunk commentedon Jul 5, 2018
Here's an example of what I'm seeing.
./src/components/button.css
./src/components/Button.js
Then, in Chome DevTools...
webpack://./src/components/button.css
webpack://./src/components/button.css?be01
Whereas I'd expect to see the original CSS source, not the JavaScript used to load it.
alexander-akait commentedon Aug 8, 2018
@jayandcatchfire problem still exists? If yep please create minimum reproducible test repo
hexpunk commentedon Aug 8, 2018
I made a minimally reproducible repo. It was mentioned in the original description.
https://github.com/JayAndCatchFire/css-loader-sourcemap-example
I can update the deps and see if it still happens in the next couple of days.
hexpunk commentedon Aug 27, 2018
@evilebottnawi I just updated it with the latest dependencies. This issue is still present.
alexander-akait commentedon Aug 28, 2018
@jayandcatchfire can you try #760?
hexpunk commentedon Aug 29, 2018
I'll give it a try shortly.
alexander-akait commentedon Dec 5, 2018
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!