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?

  • Konstantin Gerasimov's comment helped me out. It as exactly the reason. Thank you! Mar 13, 2018 at 12:11

2 Answers 2


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';
  • not sure how that is fixing the issue, what if I want to have FE compilation, that should still work right?
    – infinity
    Apr 30, 2018 at 18:42
  • 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/*

  • 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, 2018 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.