-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mix.sourceMaps() does not work #1793
Comments
I ran into a similar problem earlier. #879 fix worked for me when I added the following to my options: mix.options({
processCssUrls: false,
})
.sourceMaps()
.js(...)
.sass(...); For me there was an upstream issue with the https://github.com/bholloway/resolve-url-loader/releases/tag/v3.0.0 |
Thanks, this workaround worked for me: if ( ! mix.inProduction()) {
mix.webpackConfig({
devtool: 'inline-source-map'
})
} I'm going to leave this issue open though as I believe the original option isn't working. |
Another workaround: The second parameter is the type of of source map. The interesting thing is that if you use the default value of |
Well, I got the sass sourcemap to generate, the problem is now that the references point to the wrong files when viewed in the browser inspector. |
Omg, has this seriously been open since 18th of October? Isn't this kinda like an official package with laravel? Thx @MDooley47 at least that moves me forward for now. |
Yes, can also confirm that this appears to be buggy. How are devs working effectively without this? The code mentioned above seems to be a temporary workaround:
Note that this appears to output both JS and CSS sourcemaps in |
@SimonEast's fix doesn't work for me. I cannot get any CSS sourcemaps to be generated, either inline or separate, either in development or production. |
@75th Have you tried putting both?
AND I used to only have the webpackConfig() method and it was working fine. I haven't been debugging in Chrome lately (2+ weeks) but when I did today, I noticed that source maps weren't working anymore. Adding in mix.sourceMaps() worked. It's a quick, and dirty fix but I just needed to get the source maps up and running. |
I, too, have them both (on Mix 2.1.14) and it's working well:
|
The sourcemaps might generate, but they point to totally wrong files. For example:
In
When I open the inspector in ChromeDevTools the rule is attributed to This is a fundamental thing that works flawlessly in gulp. |
I found that |
I was experiencing same with mix 4.0. I rearranged my |
Can confirm here. With default webpack.mix.js file just added Update: |
I have also a lot of problems with sourceMaps, but by doing this:
It seems to be working now. Thanks to the information here: https://stackoverflow.com/a/37653167 |
This worked for me, but only when combined with...
Thank you @arxeiss and @filipve1994 . I'm on node |
I am facing the same problem as @bonovski, the source map is generated, but it's pointing to the wrong file or line. |
I had to use a combination of things here and other threads, this might help some people; My file, with production stuff removed (note that this is from Laravue and running
|
@bonovski did you find a solution to your issue? I'm having the same problem myself and have tried all the solutions suggested here. |
tried all workarounds posted here, the only thing that worked is to inline the map, if not, the map will generate but won't work, all the rules point to style.css as @bonovski mentioned above. here's my webpack.mix.js
|
Any solutions to @bonovski 's sass source map problem yet? |
Sass sourcemaps fail to generate in production builds due to cssnano combined with OptimizeCSSAssetsPlugin. Moving cssnano into postcss-loader resolves issue. More detail https://www.webfoobar.com/node/109 Note eval-source-maps still will not work at all for CSS, so implementers must use `Mix.sourceMaps(true, 'source-map')` to allow development builds to successfully generate sourcemaps.
Pull request #2282 resolves the prod source map issue for sass files. Details: Sass sourcemaps fail to generate in production builds due to cssnano combined with OptimizeCSSAssetsPlugin. Moving cssnano into postcss-loader resolves issue. More detail https://www.webfoobar.com/node/109 Note eval-source-maps still will not work at all for CSS, so implementers must use |
@bentaber Thank you! I was wrestling with this problem for hours, and after manually patching Mix with the code from your PR, it's working perfectly. Let's hope it's merged in soon. |
Anyone got any of the eval* sourcemap options working? |
It Worked for me aswell! tnks! |
Yeah, the problem is that the "eval-source-map" (or any other eval* option for that matter) doesn't work and since it's set as default for sourceMaps() in development, it seems like sourceMaps() doesn't work. More elegant solution is for example |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
* Fix prod css/sass sourcemaps (#1793) Sass sourcemaps fail to generate in production builds due to cssnano combined with OptimizeCSSAssetsPlugin. Moving cssnano into postcss-loader resolves issue. More detail https://www.webfoobar.com/node/109 Note eval-source-maps still will not work at all for CSS, so implementers must use `Mix.sourceMaps(true, 'source-map')` to allow development builds to successfully generate sourcemaps. * Add cssnano to postcss plugins * Allow cssNano config options to be specified * remove comment
source map created
How can remove the "webpack:///" prefix for files.less path in Styles ?
|
sadly not working for me :( my setup:
webpack.mix.js:
Screenshot of browser console: |
correct code: but i don't change path, for example |
…workaround > People had similar problems with laravel-mix and sourcemaps() in here laravel-mix/laravel-mix#1793
node -v
): 10.12.0npm -v
): 6.4.1Description:
Following the documentation here: https://laravel.com/docs/5.7/mix#css-source-maps
mix.sourceMaps()
doesn't work. It's not adding source maps.Steps To Reproduce:
Add
mix.sourceMaps()
to yourwebpack.mix.js
file and thennpm run dev
.Here is my
webpack.mix.js
file:The text was updated successfully, but these errors were encountered: