laravel-mix: sass no longer outputting (v2.1.4 -> v4)
- Laravel Mix Version: 4.0.6no
- Node Version (
node -v): 9.9.0 - NPM Version (
npm -v): 6.50 - OS: Windows 10
Description:
In version 2 there were no problems with extracting specific libraries as well as building sass - after getting everything “working” with the update to v4 I am no longer able to get any output from scss files.
Steps To Reproduce:
mix.js('resources/assets/js/main.js', 'public/gen/js')
.sass('resources/assets/scss/main.scss', 'public/gen/css')
.version();
mix.js('resources/assets/js/spa.js', 'public/js/spa.js');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/scss/theme.scss', 'public/css')
.version();
mix.js('resources/assets/js/z.js', 'public/js')
.extract([
'jquery',
'bootstrap',
'moment',
])
.sass('resources/assets/scss/style.scss', 'public/css/z.css');
The above outputs css files which are all empty whereas before they worked just fine. In addition to that issue - the extract function no longer works as it used to and you cannot specify specific libraries.
I do not have any webpack config overrides either.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (3 by maintainers)
Upon further investigation it actually will not work if I do not have the following block:
It seems to be something related to files with chunk names
Same issue here. Using the following webpack.mix.js:
… results in an empty CSS file.
If I disable the extract line, it produces a valid CSS file. Both
devandprodbuilds produce the same 0 result.I have tried:
extractline results in normal CSS outputWhile testing, I noticed the issue with
@babel/plugin-syntax-dynamic-import(v7.2.0). Usingextractand the following results in 0 CSS. Disablingextract`` or thecontactForm``` line results in normal CSS output.I know there are currently issues with the
syntax-dynamic-importplugin, so I am not expecting a solution until webpack v5 / laravel-mix v5. But stranger things have happened before at this time of year, so who knows. 😉Laravel-mix: 4.0.8 OS: Win10
Because there are CSS extraction issues with that plugin, too. This will all be fixed when webpack offers CSS entry points in v5.
Update: After seeing the recently-published article below I was happy to see I could finally add dynamic imports to my Laravel + Vue SPA project. Spent a few hours getting everything working only to realize there is still the “empty CSS” problem. (And in fact I ran into this problem a few months ago as well but forgot about it!)
The article claims that v4.0.16 supports dynamic imports, but unfortunately use of dynamic imports while using extract() still results in empty CSS.
Using Dynamic Imports with Laravel Mix https://laravel-news.com/using-dynamic-imports-with-laravel-mix
I wonder if there is an alternative to this as the lazy loading is quite an important thing for my project.
Unfortunately so far the only thing I am able to pin-point is that it has something to do with extracting specific libraries via.
I can’t seem to replicate the problem outside of this project which is likely to indicate something else going on but at this point I have no idea what as i’ve purged all modules and updated everything that could be updated.
Using the old version also works.