Skip to content

Cannot enqueue CSS and JS asset with the same handle #30

Description

@johnbillion

In the WordPress world it's possible for a CSS dependency and a JS dependency to share the same handle. When using Asset Loader, this works fine for a production build but not when using webpack-dev-server during dev.

It appears that the latterly registered dependency gets skipped completely. In the example below, the main.js file gets enqueued but the style.css file does not.

\Asset_Loader\enqueue_asset(
	plugin_dir_path( __DIR__ ) . 'build/asset-manifest.json',
	'main.js',
	[
		'handle' => 'hello-world',
	]
);
\Asset_Loader\enqueue_asset(
	plugin_dir_path( __DIR__ ) . 'build/asset-manifest.json',
	'style.css',
	[
		'handle' => 'hello-world',
	]
);

May be related to #27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions