akanix42 / meteor-css-modules

MIT License
92 stars 20 forks source link

Disable generating SourceMaps? #104

Open tjramage opened 7 years ago

tjramage commented 7 years ago

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 commented 7 years ago

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

akanix42 commented 7 years ago

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.

tjramage commented 7 years ago

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

egemon commented 6 years ago

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?))

yched commented 6 years ago

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

cdolek commented 6 years ago

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

akanix42 commented 6 years ago

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 commented 6 years ago

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