Thanks Colin. Dug around a little and figured out all I needed was:
<meta name="gwt:property" content="baseUrl=/dt/" />
("dt" is my GWT module short name)
Now everything works, including superdevmode. Ie: No need for the
gwtNoCacheJs.contains("superdevmode") check anymore.
I think my page does load a bit faster now (on subsequent times, not the
first visit). https://drift.team/ if anyone is curious what the end result
root html source looks like.
On Friday, 13 February 2026 at 10:16:23 am UTC+11 Colin Alworth wrote:
> I believe that
> https://github.com/gwtproject/gwt/blob/main/dev/core/src/com/google/gwt/core/ext/linker/impl/computeScriptBase.js
>
> is what you're going to want to read, or possibly replace on your
> classpath. Alternatively, subclass the CrossSiteIframeLinker to override
> getJsComputeScriptBase(LinkerContext) to provide your own file.
>
> From that file:
> /**
> * Determine our own script's URL by trying various things
> *
> * First - use the baseUrl meta tag if it exists
> * Second - look for a script tag with the src set to
> MODULE_NAME.nocache.js and
> * if it's found, use it to determine the baseUrl
> * Third - if the page is not already loaded, try to use some
> document.write
> * magic to install a temporary tag and use that to determine the
> baseUrl.
> *
> * This is included into the selection scripts
> * wherever COMPUTE_SCRIPT_BASE appears with underlines
> * on each side.
> */
>
> The "Second" step is where you appear to be getting stuck - since there is
> no script tag with a src attr, the rest of the loading code doesn't know
> what to do. So, add a meta tag for baseUrl so the script knows where the
> other resources are loaded from.
>
> Note that I haven't messed with this in years, and might have missed a
> point or two.
>
> On Thursday, February 12, 2026 at 4:54:23 PM UTC-6
> [email protected] wrote:
>
>> I tried to inject the non-dev nocache.js into my main index.html file.
>> Like this:
>>
>> String gwtNoCacheJs = loadFileFromServlet("/dt/dt.nocache.js");
>>
>> if (gwtNoCacheJs.contains("superdevmode")) {
>> gwtNoCacheJs = "<script type='text/javascript'
>> src='/dt/dt.nocache.js'></script>";
>> }
>> else {
>> gwtNoCacheJs = "<script type='text/javascript'>\n" + gwtNoCacheJs + "\n
>> </script>";
>> }
>>
>> String html = loadFile("index.html").replace("XXX", gwtNoCacheJs);
>>
>> However, it doesn't work, as nocache.js wants to load files from the same
>> sub directory it's located in, and not the root directory.
>>
>> Has anyone done this? It probably isn't work the effort, as it'll only
>> save one network call, but I was curious if it's possible.
>>
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/google-web-toolkit/a77a4ea3-c4ed-48b8-bd3e-c3877109fd6bn%40googlegroups.com.