Page MenuHomePhabricator

Consider moving bundlesize.config.json info into ResourceLoaderModule definitions
Closed, DeclinedPublic

Description

Following-up from T255149, in https://gerrit.wikimedia.org/r/c/737767 an idea came up to move the bundlesize.config.json definitions into the ResourceLoaderModule definitions. So instead of a file like bundlesize.config.json that contains this information:

[
	{
		"resourceModule": "skins.minerva.base.styles",
		"maxSize": "6.6KB"
	},
        ...
]

We'd update the skin.json to have something like:

"ResourceModules": {
		"skins.minerva.base.styles": {
                       "maxSize": "6.6KB",
			"class": "MediaWiki\\Minerva\\ResourceLoaderSkinModule",
			"features": [ "i18n-ordered-lists", "content-body", "content-links" ],
			"targets": [
				"mobile",
				"desktop"
			],
			"styles": [
				"resources/skins.minerva.base.styles/skin.less",
				"resources/skins.minerva.base.styles/content/index.less"
			]
		},

Event Timeline

Krinkle triaged this task as Medium priority.Dec 7 2021, 7:25 PM
Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.
Krinkle updated the task description. (Show Details)
Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.

One downside is that the npm tool wouldn't work with the ResourceLoaderModule definitions. Maybe that doesn't matter if we want people to run bundlesize checks with composer test:size.

I'd personally prefer keeping this out of ResourceLoader. If we ever decided the tool wasn't useful it will be easier to remove (And detect usage) if it's in a standalone configuration file. It's also not needed outside CI.

I think we had a similar conversation a while back about whether to put bundlesizeconfig in package.json and decided we preferred multiple config files to putting everything in package.json

Okay, let's start with T255149 for now and see how that goes for a while. Closing this out for now, but we can revisit it in a few months based on the experience gathered.