5

I merged and minified JS files and CSS files and now my Magento 2 is throwing below error:

Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Argument 4 passed to Magento\\Developer\\Model\\View\\Asset\\PreProcessor\\FrontendCompilation::processContent() must be an instance of Magento\\Framework\\View\\Asset\\File\\FallbackContext, instance of Magento\\Framework\\View\\Asset\\File\\Context given, called in vendor/magento/module-developer/Model/View/Asset/PreProcessor/FrontendCompilation.php on line 90 and defined in vendor/magento/module-developer/Model/View/Asset/PreProcessor/FrontendCompilation.php:107\nStack trace:\n#0 vendor/magento/module-developer/Model/View/Asset/PreProcessor/FrontendCompilation.php(90): Magento\\Developer\\Model\\View\\Asset\\PreProcessor\\FrontendCompilation->processContent('c7e57e76387ecc5...', '@import 'source...', '', Object(Magento\\Framework\\View\\Asset\\File\\Context))\n#1 vendor/magento/module-developer/Model/View/Asset/PreProcessor/PreprocessorStrategy.php(74)...\n'

How to solve this?

MagExt
  • 1,833
  • 2
  • 16
  • 24

2 Answers2

6

This is because you are using client-side LESS compilation.

Switch to server-side LESS compilation by running this SQL:

update core_config_data set value='server_side_compilation' where path='dev/front_end_development_workflow/type';
Konstantin Gerasimov
  • 4,273
  • 23
  • 37
  • not sure how that is fixing the issue, what if I want to have FE compilation, that should still work right? – infinity Apr 30 '18 at 18:42
1
  • Now first check current application mode:developer Minification is not applied in developer mode so please apply this command and check it.

    php bin/magento deploy:mode:set production

    rm -rf var/cache/* var/generation/*

Ravindrasinh Zala
  • 2,125
  • 3
  • 14
  • 46
  • Is that the answer, about the minification? via the admin those options only appear in Developer mode, seems wrong that you can enable to them break the site. – Joel Davey Dec 12 '18 at 18:40