meteor-css-modules icon indicating copy to clipboard operation
meteor-css-modules copied to clipboard

Disable generating SourceMaps?

Open tjramage opened this issue 7 years ago • 8 comments

The sourceMappingUrl comment that is added to the bottom of our styles (that appear in the HTML head) doesn't actually resolve to a proper source map.

I'm using babel-plugin-react-css-modules instead of react-css-modules, which means I simply import my styles without declaring a reference in my React components, and it maps the styleName prop to the imported SCSS stylesheet: import 'App.scss'

Can you tell me if there is a way to disable these source maps entirely? It basically means we end up with tons of "Failed to parse SourceMap" errors in the browser console:

sourcemaps

As well as being able to disable these (I tried running Meteor in production mode and they are still generated), is there any way to resolve the broken source map references?

Thanks!

tjramage avatar Aug 04 '17 19:08 tjramage

@nathantreid — Sorry... any help on the above? Thanks!

tjramage avatar Sep 14 '17 17:09 tjramage

Sorry about the slow response! This isn't currently a customizable option; I'll look into it when I get a chance, but in the meantime if you want to change it in a local copy of the package, it's probably coming from here.

akanix42 avatar Sep 14 '17 22:09 akanix42

No worries @nathantreid — thanks for the reply. I'll look into running a customised local package at some point. Cheers.

tjramage avatar Sep 14 '17 22:09 tjramage

Hey guys, I am getting this warnings too. How could i change it in local package? Don't u propose me to go to node_modules folder?))

egemon avatar Nov 14 '17 14:11 egemon

Like the OP, I'm seeing the "DevTools failed to parse SourceMap: http://localhost:3000/url/of/the/page/currently/being/viewed/minus/the/last/part/MyComponent.css.map" messages in Chrome.

Rather than disabling sourceMaps, though, I'd like to get them working :-) (although being able to disable them in production would also be nice I guess...)

I'm not sure at which URL they're supposed to be available, but with the current /*# sourceMappingURL=MyComponent.css.map */ comment, Chrome apparently tries to fetch them from a URL relative to the current page, which if course fails

yched avatar Jan 02 '18 18:01 yched

Hi @nathantreid forked the package in order to work on this issue but when I use the local version (which I generated by ./prepare.sh) it downgrades to 2.8 from 3.0 and installs other npm packages which were not previously installed. Any recommendations?

Thanks

cdolek avatar Jan 08 '18 21:01 cdolek

You can update the version number in package.js. Btw, 2.8 and 3.0 are the same. To support both Meteor 1.6 and 1.5, I needed to introduce a major version update. When building locally like you're doing, there are no differences between the two. Looks like I need to commit my changelog! The npm packages it's installing are ones used by my css-modules plugin. They aren't accessible to the rest of the app.

Let me know if you have any more questions!

akanix42 avatar Jan 08 '18 23:01 akanix42

@cdolek I believe this issue has been fixed in v3.0.1. Please give it a shot!

akanix42 avatar Jan 23 '18 00:01 akanix42