← All changes
|
includes/core/widgets/diviModulesV5/class-manager.php
+20
-1
3.12.1
→
3.13.3
View file →
| @@ -57,15 +57,34 @@ | ||
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | $js_file = $build_dir . 'wpfnl-divi5-vb.js'; |
| 60 | 60 | if ( ! file_exists( $js_file ) ) { |
| 61 | + // Without this bundle Divi 5 never calls registerModule(), so the | |
| 62 | + // WPFunnels modules are missing from the module library with no | |
| 63 | + // visible error — it looks like a Divi incompatibility. Surface it | |
| 64 | + // so the real cause (an unbuilt bundle) is diagnosable. | |
| 65 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { | |
| 66 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 67 | + error_log( | |
| 68 | + 'WPFunnels: Divi 5 Visual Builder bundle missing at ' . $js_file | |
| 69 | + . ' — run `npm ci && npm run build` in' | |
| 70 | + . ' includes/core/widgets/divi-modules/divi-5/visual-builder/.' | |
| 71 | + . ' WPFunnels modules will not appear in the Divi 5 builder.' | |
| 72 | + ); | |
| 73 | + } | |
| 61 | 74 | return; |
| 62 | 75 | } |
| 63 | 76 | |
| 77 | + // Must list every Divi package the bundle externalises — see the | |
| 78 | + // `externals` map in visual-builder/webpack.config.js. An external | |
| 79 | + // left out here only works while Divi happens to print that package | |
| 80 | + // first, and silently throws the moment a Divi update reorders them. | |
| 81 | + // Deliberately excludes divi-module-library: we must print *before* | |
| 82 | + // it so we still catch the registerModuleLibraryStore.after action. | |
| 64 | 83 | wp_enqueue_script( |
| 65 | 84 | 'wpfnl-divi5-vb', |
| 66 | 85 | $build_url . 'wpfnl-divi5-vb.js', |
| 67 | - [ 'divi-vendor-react', 'divi-vendor-wp-hooks', 'divi-module', 'divi-rest' ], | |
| 86 | + [ 'divi-vendor-react', 'divi-vendor-wp-hooks', 'divi-module', 'divi-rest', 'divi-icon-library' ], | |
| 68 | 87 | \WPFNL_VERSION . '.' . (string) filemtime( $js_file ), |
| 69 | 88 | true |
| 70 | 89 | ); |
| 71 | 90 | |