m2-boilerplate / Module-Critical-CSS

Magento 2 module to automatically generate critical css with the addyosmani/critical npm package
MIT License
34 stars 16 forks source link

Area code is already set #15

Open deancodes opened 2 years ago

deancodes commented 2 years ago

Hi there, I just wanted to raise an issue we have started experiencing.

bin/magento m2bp:critical-css:generate will throw the following error:

In State.php line 136: Area code is already set

I believe the solution is to modify line 84 of vendor/m2-boilerplate/module-critical-css/src/Console/Command/GenerateCommand.php to:

            if ( ! $this->state->getAreaCode()) {
                $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
            }

I have confirmed this resolved our issue.