Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#17011 closed defect (fixed)

[regression] require.undef is broken

Reported by: Martin Minka Owned by: Rawld Gill
Priority: undecided Milestone: 1.9
Component: Loader Version: 1.9.0b2
Keywords: Cc:
Blocked By: Blocking:


This code worked and doesn't in 1.9.0b2

name = 'dojo/colors';

Problem is that Dojo will create request: GET http://localhost/0

Reason is the latest change:

mix(module, {def:0, executed:0, injected:0, node:0, url:0});

Url is set to 0 and will not be re-created when request is made.

Change History (7)

comment:1 Changed 6 years ago by bill

Component: CoreLoader
Milestone: tbd1.9
Owner: set to Rawld Gill
Summary: require.undef is broken[regression] require.undef is broken

Broken in [30927]. I've never heard of require.undef() before; I'm not sure that's a public API.

comment:2 Changed 6 years ago by Martin Minka

It gives many interesting usages and I think it is public, because require.undef is mentioned here:

comment:3 Changed 6 years ago by Rawld Gill

Resolution: fixed
Status: newclosed

In [31264]:

improved undef to not erase the computed url of a module (note that the url *is* recomputed during undef); fixes #17011; !strict

comment:4 Changed 6 years ago by Rawld Gill

fwiw, the undef API originated in the backdraft loader years ago and was included in the dojo loader. It looks like requirejs is now supporting it as well. That said, there is no agreed standard API.

[31264] does not erase the module URL, which was being erased as of [30927]. Notice that undef does recompute the URL. This is important since it gives error recovery/testing machinery the opportunity to change the way a URL is computed before undefining a module...which could have the net effect of pointing a module to a different URL.

comment:5 Changed 5 years ago by mc007

Hi, I am having a hard time to reload modules through the undef-api. The undef seems to work and the re-load (requirexide.widgets.SelectWidget?) also requested the module file but when using the module later on, it can't be found, saying : xide.widgets.SelectWidget? is not a constructor. Any ideas ? thank you!

comment:6 Changed 5 years ago by dylan

I assume you would require it with a valid AMD mid (e.g. xide/widgets/SelectWidget) and not the legacy xide.widgets.SelectWidget? format that you said in your comment @mc007?

comment:7 Changed 5 years ago by mc007

Ups, I really meant xide/widgets/SelectWidget too, just forgot to fix the dots. However, I discovered a mistake in my code and finally all works as expected, sorry that I did bother you.

thank you very much for the prompt response!

Note: See TracTickets for help on using tickets.