Skip to content

Warning on missing runtime asset.php file while using prod build #184

@kadamwhite

Description

@kadamwhite

Since 0.3.0 we're observing this warning,

NOTICE: PHP message: PHP Warning:  include(/wp/wp-content/client-mu-plugins/authorship/build/runtime.asset.php): Failed to open stream: No such file or directory in /wp/wp-content/client-mu-plugins/authorship/inc/namespace.php on line 512
NOTICE: PHP message: PHP Warning:  include(): Failed opening '/wp/wp-content/client-mu-plugins/authorship/build/runtime.asset.php' for inclusion (include_path='.:/usr/share/php') in /wp/wp-content/client-mu-plugins/authorship/inc/namespace.php on line 512

The plugin is functional as-is but this noisy error should be resolved.

This is due to our unrestrained attempt to load the runtime file optimistically even when not necessarily needed:

$runtime_asset = include plugin_dir_path( __DIR__ ) . 'build/runtime.asset.php';
	if ( ! empty( $runtime_asset ) && in_array( 'wp-react-refresh-runtime', $editor_asset['dependencies'] ?? [], true ) ) {

We should instead check first whether the refresh runtime has been requested and that our expected runtime bundle is readable, before trying to load the file.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions