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.

not generate css sourcemap when compile sass with mix.sourceMaps()

See original GitHub issue

Version

Laravel Mix Version: 0.12.1 Node Version: v6.6.0 NPM Version: 4.1.2 YARN Version: 0.22.0 OS: MacOS Sierra

Description:

not generate css sourcemap when compile sass with mix.sourceMaps() . But it generate css sourcemap correct when not call mix.sourceMaps(). Hoverer, it generate js sourcemap when call mix.sourceMaps() and it does not generate sourcemap when not call mix.sourceMaps().

Steps To Reproduce:

laravel new project yarn install dependence

default:

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

run npm run dev app.js(no sourcemap) app.css(sourcemap) screenshot

But

add sourceMaps()

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css').sourceMaps();

run npm run dev app.js(sourcemap) app.css(no sourcemap)

screenshot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:20
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

81reactions
adampattersoncommented, Dec 27, 2017

@lorenaramonda Everything is still working as expected.

The one thing I noticed, however, is that you do need to have .sourceMaps() somewhere in your config or the source maps wont be connected. It doesn’t matter where, So I updated my little source map block.

if (!mix.inProduction()) {
    mix.webpackConfig({
        devtool: 'source-map'
    })
    .sourceMaps()
}

I feel it’s faster when you run a production build, Not scientific at all but it seems to be consistently a few seconds faster

Dev: 16.7 ( Sourcemaps ) Prod: 30 ( Sourcemaps ) Prod: 26.8 ( No Sourcemaps )

Hope that Helps.

72reactions
kulek1commented, Jun 23, 2017

I have exactly the same issue as you @green-mike and I found a temporary solution: Add these lines to webpack.mix.js mix.webpackConfig({ devtool: "inline-source-map" });

Read more comments on GitHub >

github_iconTop Results From Across the Web

not generate css sourcemap when compile sass with mix ...
sourceMaps(). Hoverer, it generate js sourcemap when call mix.sourceMaps() and it does not generate sourcemap when not call mix.sourceMaps().
Read more >
Laravel Mix Sourcemaps not generating for production build
I couldn't find any documentation with Laravel Mix to support this though. Any idea how I can fix this?
Read more >
sourceMaps problem with Laravel Mix - Laracasts
I'm experiencing a strange behavior when trying to generate source maps for my css and javascript files. I'm not able to generate source...
Read more >
Elixir - Laravel guide
Compiling Assets (Laravel Elixir). Introduction; Installation & Setup; Running Elixir; Working With Stylesheets. Less; Sass; Stylus; Plain CSS; Source Maps.
Read more >
Laravel 5.8 Compiling Assets (Mix) - ReaDouble
Though disabled by default, source maps may be activated by calling the mix.sourceMaps() method in your webpack.mix.js file. Though it comes with a...
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