#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: |
Description
This code worked and doesn't in 1.9.0b2
name = 'dojo/colors'; require.undef(name); require([name]);
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 8 years ago by
Component: | Core → Loader |
---|---|
Milestone: | tbd → 1.9 |
Owner: | set to Rawld Gill |
Summary: | require.undef is broken → [regression] require.undef is broken |
comment:2 Changed 8 years ago by
It gives many interesting usages and I think it is public, because require.undef is mentioned here:
comment:4 Changed 8 years ago by
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 7 years ago by
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 7 years ago by
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 7 years ago by
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!
Broken in [30927]. I've never heard of require.undef() before; I'm not sure that's a public API.