WordPress/gutenberg

DEWP docs and implementation mismatch/confusion in regards of assets file name

開放

#49,872 建立於 2023年4月17日

 (2 則留言) (0 個反應) (1 位負責人)JavaScript (3,893 個分叉)batch import
Good First Issue[Status] In Progress[Tool] Dependency Extraction Webpack Plugin[Type] Developer Documentation

倉庫指標

星標
 (9,607 顆星)
PR 合併指標
 (平均合併 12天 18小時) (30 天內合併 509 個 PR)

描述

Description

The Dependency Extraction Webpack Plugin docs states:

// Source file entrypoint.js // […] // Webpack will produce the output output/entrypoint.js // […] // Webpack will also produce output/entrypoint.asset.php declaring script dependencies

Therefore, when I have entry: { 'analytics': '…' }, I'd expect the assets file name to be analytics.asset.php.

However, it's effectively different, as per implmentation it takes explicitly output's file name (assetFilename = compilation.getPath( outputFilename). Which can be completely different.

Step-by-step reproduction instructions

  1. Create a bundle that uses DEWP (and default WordPress webpack config)
{
	...require( '@wordpress/scripts/config/webpack.config' ),
	entry: {
		'entrypoint': './path/to/some/index.js',
	},
	output: {
		filename: 'bunny-plugin-[name].min.js',
		path: './output/',
	},
  1. Run the build.
  2. :red_circle: Check that assets file is output/bunny-plugin-entrypoint.min.asset.php not output/entrypoint.asset.php.

So I'd rather describe it as output/filename.asset.php

Screenshots, screen recording, code snippet

No response

Environment info

n/a - I'm using only @wordpress/scripts and @wordpress/dependency-extraction-webpack-plugin

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

貢獻者指南