function resolveAlias(alias, url) {
	if (url.startsWith('/@alias')) {
		url = url.slice('/@alias'.length);
	}

	let partial = url;
	for (let name in alias) {
		// Exact alias matches take precedence
		if (url === name) return alias[name];

		// Only check path-like alias mapping
		if (!name.endsWith('/*')) continue;

		// Trim "*" at the end to get a valid path
		const value = alias[name];
		name = name.slice(0, -1);

		if (partial === url && url.startsWith(name)) {
			partial = path.resolve(value, url.split(path.posix.sep).join(path.sep).slice(name.length));
		}
	}

	return partial;
}
Resolve an aliased url to an absolute file path, unless it's referring
to an npm module.
@param {Record<string, string>} alias
@param {string} url