question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable CSS sourcemaps in development

See original GitHub issue

Hi! Firstly, of course, thank you for this amazing project! 👏

I’ve seen the comments on sourcemaps: #109, #139, #494, #343, etc. but didn’t see one about enabling CSS sourcemaps. I thought I’d make a PR first but I wanted to discuss first and get to grips with this repo structure.

Since there aren’t breakpoints to worry about, this could be a very simple enhancement, e.g:

loader: 'style-loader!css-loader?'.concat(isProduction ? 'minimize' : 'sourceMap')

where const isProduction = process.env.NODE_ENV === 'production'. Apologies if I am duplicating / creating noise, I thought I’d searched thoroughly.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pastinepolentacommented, Nov 13, 2017

as @skaltenegger wrote the config for webpack 2 is

{
    test: /\.css$/,
    use: [
         require.resolve('style-loader'),
         {
             loader: require.resolve('css-loader'),
             options: {
                 importLoaders: 1,
                 sourceMap: 1
             },
          },
          ....
1reaction
skalteneggercommented, Apr 20, 2017

I got CSS sourcmaps and hot reloading working by following @mareksuscak’s advice of changing my css loader in the webpack config to the following:

{ test: /.css$/, loader: ‘style!css?sourceMap!postcss’ },

And I can’t complain about FOUC (flash of unstyled content) - so all good for development!

Hope that may help someone here! 😎

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable source maps for your browser. - gists · GitHub
Open Developer Tools. Mac users: View > Developer > Developer Tools. · Click the Settings cog icon in the upper-right corner of the...
Read more >
Should I Use Source Maps in Production? | CSS-Tricks
Typically, source maps are a configuration option from the preprocessor. Here's Babel's options. I believe that with Sass, you don't even have ...
Read more >
Getting started with CSS sourcemaps and in-browser Sass ...
CSS sourcemaps allow the browser to map CSS generated by a ... Open your developer tools settings, and under Workspace add your site's...
Read more >
Using SASS source maps with Chrome (Example) - Coderwall
Next open the Chrome developer tools pane, click on settings (the gear in the bottom right corner). · Navigate to Experiments and click/enable...
Read more >
Chrome not loading CSS source maps? - Stack Overflow
5 Answers 5 · Make sure that CSS maps are enabled in Dev tools settings. · Check the end of CSS file whether...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found