Great success!
Apparently I could simply add the file to the module.config file, like so:
<add name="epi-cms.widgets.base" path="my/modified/version/of/a/dojo/file.js" resourceType="Script"/>
And it will be used instead of the original function, I assume because the dojo system only load one "define(..." once, and mine is loaded before the original (in widgets.js). Though I fear this can sometimes break depending on the order the files are loaded.
This could lead to multiple define errors in the AMD loader. A better approach would be to use an alias. This is a bit of configuration in the module.config that says run my file instead, e.g.:
<?xml version="1.0" encoding="utf-8" ?> <module> <dojo> <packages> <add name="my-app" location="ClientResources" /> </packages> <aliases> <add from="epi-cms/widget/FileList" to="my-app/FileList" /> </aliases> </dojo> </module>
Nice, this seem like a cleaner approach.
Can you register a dojo alias programmatically?
Edit: Ah, I seem to be lost anyways on what exactly I should set. Could you possibly write up a complete modules.config example to replace:
[version]\ClientResources\epi-cms\widget\FileList.js
with
/ClientResources/myapp/FileList.js
The files will be identical, im just trying to understand exactly how the aliases work here.
As the topic states, can you route edit mode/dojo javascript file requests to an alternative file in some sort of "official way"?
Using episerver 8+, can you in some way tell epi to instead of reading ex. the file (in EPiServer.Cms.Shell.UI.zip) "[version]\ClientResources\epi-cms\widget\FileList.js", read another file located somewhere else on disk?
And yes, I know this can break episerver in so many wonderful ways..