3

I have a simple GWT app. Whenever I run gwt compilation for production, I also see a file with the extension .devmode.js being generated.

Questions:

  • This looks like a devmode-related file; do I actually need it while running in production? Do I need to delete it?
  • What does it do?
  • If useless, is there any way to stop it from being generated while in production?

I'm using GWT 2.8.

Kind regards, Andrei

Andrei
  • 1,613
  • 3
  • 16
  • 36

1 Answers1

2

It is specific to legacy Dev Mode, and not used in Super Dev Mode. If you don't ever use legacy Dev Mode, you don't need it.

You don't need it in production... unless you ever need to debug your app in production. If you ever want to debug your app in production (with legacy dev mode), you should leave it.

You do not need to delete it - it will not be used unless you attempt to enter dev mode, and it is a static file, and cannot be used to maliciously debug your app, unless the attacker also has all of your original Java source code already.

The Linker system does not currently have a way to prevent it from being emitted. The "generation" of it is very simple, only the __MODULE_NAME__ tokens are replaced with the name of your app, so there is essentially no penalty paid in creating it.

Unless you need the extra 1k of disk space in your generated app, I wouldn't worry about it at all as there is no risk in having it. If you do need that extra 1k, either modify your current linker to avoid emitting it, or add a later build step to delete it.

Colin Alworth
  • 17,801
  • 2
  • 26
  • 39
  • Thanks. Not to nitpick, but are there any docs you can point me to? I'd like to have a look myself (and I wasn't able to actually find them). – Andrei May 05 '17 at 07:53
  • Hmm - you are looking for docs that say "don't delete this file that is autogenerated with every build"? I went into the gwt source and read the contents of devmode.js, and found instances of that string in .java files (specifically `com.google.gwt.core.linker.CrossSiteIframeLinker` and its superclass). The JS file shows it trying to start up a dev mode browser plugin to connect to the code server, and the java references it to make the change I described, and emit it as an output artifact. Do you need more? or have specific questions? – Colin Alworth May 05 '17 at 13:55
  • I wanted the docs that say anything at all about that file ('cause I was a bit flustered about not finding much on google), or docs that support your statements; I'll go look through the code as well, thank you! – Andrei May 05 '17 at 14:04