Try our conversational search powered by Generative AI!

Can you overload a javascript file in dojo/the edit mode?


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 "[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..

May 27, 2015 11:47

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.

May 27, 2015 19:56

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" ?>
      <add name="my-app" location="ClientResources" />
      <add from="epi-cms/widget/FileList" to="my-app/FileList" />
Jun 05, 2015 14:53

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:




The files will be identical, im just trying to understand exactly how the aliases work here.

Edited, Jun 05, 2015 16:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.