Topic on Talk:ResourceLoader/Package files

Jump to navigation Jump to search

What happens with conflicting definitions?

2
Jdlrobson (talkcontribs)

[ 'foo/bar.js', 'blah.js' => 'foo/bar.js' ]

Is this supported? Does code get loaded twice? I'm curious as I'm not 100% sure why aliasing is needed (some more context on that would be useful).

Roan Kattouw (WMF) (talkcontribs)

Technically this is not a conflicting definition :P . Yes, the code would get loaded twice under two different names, and it's not recommended that you use aliasing this way.

The main reasons aliasing exists is because it's sort of already there for dynamic files, and because it lets you simplify file paths (this ended up being done with localBasePath instead, but an alternative that I was using previously was writing definitions like [ 'foo.js' => 'resources/src/blah/foo.js', 'bar.js' => 'resources/src/blah/bar.js', ... ]

In practice, I don't expect aliasing of real files to be used much, but I'd like it to be possible.

I should also point out that I wrote this documentation (at least initially) as a complete list of everything you can do, without necessarily indicating what's meant to be commonly used and what's meant to be exceptional.

Reply to "What happens with conflicting definitions?"