Log1x / sage-directives

A set of Blade directives for use with Roots Sage.

Home Page:https://log1x.github.io/sage-directives-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Target class [blade.compiler] does not exist" after upgrading to Acorn v3

mrmadhat opened this issue · comments

I'm having an issue using sage-directives after upgrading to Acorn v3. I can use directives within blade files as per usual and everything works correctly when viewing the site but I can no longert use wp cli.

  1. Upgrade Acorn from version ^2.1 to version 3.0
  2. Run wp acorn
  3. The cli doesn't return any output and the following error is added to the debug.log:
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [blade.compiler] does not exist. in /app/vendor/illuminate/container/Container.php:891
Stack trace:
#0 /app/vendor/illuminate/container/Container.php(770): Illuminate\Container\Container->build('blade.compiler')
#1 /app/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(860): Illuminate\Container\Container->resolve('blade.compiler', Array, true)
#2 /app/vendor/illuminate/container/Container.php(706): Illuminate\Foundation\Application->resolve('blade.compiler', Array)
#3 /app/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make('blade.compiler', Array)
#4 /app/vendor/roots/acorn/src/Illuminate/Foundation/helpers.php(120): Illuminate\Foundation\Application->make('blade.compiler', Array)
#5 /app/vendor/roots/acorn/src/Roots/helpers.php(108): app('blade.compiler')
#6 /app/web/app/themes/theme/vendor/log1x/sage-directives/src/Directives.php(90): Roots\app('blade.compiler')
#7 /app/web/app/themes/theme/vendor/log1x/sage-directives/src/Directives.php(35): Log1x\SageDirectives\Directives->blade()
#8 /app/web/wp/wp-includes/class-wp-hook.php(307): Log1x\SageDirectives\Directives->Log1x\SageDirectives\{closure}('')
#9 /app/web/wp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#10 /app/web/wp/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#11 /app/web/wp/wp-settings.php(576): do_action('after_setup_the...')
#12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1336): require('/app/web/wp/wp-...')
#13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1254): WP_CLI\Runner->load_wordpress()
#14 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#15 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#16 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#17 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')
#18 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#19 {main}
  thrown in /app/vendor/illuminate/container/Container.php on line 891

I wonder if there's any reason for sage-directives to be included in wp cli. For now, I excluded the library from wp-cli by checking if blade.compiler exists too.

if (function_exists('Roots\app') && \Roots\app()->bound('blade.compiler')) {
    return \Roots\app('blade.compiler');
}

I can confirm the same behavior as @mrmadhat in a clean install of Sage 10 with Acorn v3.0 and that @iniznet's edit to sage-directives/src/Directives.php allows wp-cli to function again.

Nice temp fix while things get sorted. 🤘🏻