Hello everyone,
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 maps files. In fact, they're generated ONLY when running npm run production, but the css one is empty.
We've got a project with big stylesheets made with sass, but I'm experiencing the same problem on a brand new project with laravel new.
I set up Node and Npm as described here.
This is my webpack.mix.js file:
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.sourceMaps();
npm run dev
Now, after running npm run dev I got a big app.js and an app.css, both without map files.
/js/app.js 3.22 MB 0 [emitted] [big] /js/app
/css/app.css 144 kB 0 [emitted] /js/app
The file app.js seems to have inside a big section of code starting with this:
sourceMappingURL=data:application/json;charset=utf-8;base64, ...
By removing sourceMaps();, I get this:
/js/app.js 1.19 MB 0 [emitted] [big] /js/app
/css/app.css 681 kB 0 [emitted] /js/app
npm run production
With .sourceMaps();
By running npm run production i get this:
/js/app.js 291 kB 0 [emitted] [big] /js/app
/css/app.css 114 kB 0 [emitted] /js/app
/js/app.js.map 299 kB 0 [emitted] /js/app
/css/app.css.map 82 bytes 0 [emitted] /js/app
So there is definitely something wrong with Mix or Sass either.
- Map files generated only with production command
- Bigger app.js file generated with dev containing a lot of encoded code (is this expected?)
- While the map file for app.js contains code, the css one is empty. Is there something wrong with Sass?
Can someone explain what's happening?
Thanks