Unit Initialization not executed in Release mode, works in Debug

The attached sample will reproduce the issue, in release 0 transforms are added to the registry and in debug 2 transforms are added.

The error occurs when the units are not included in the project ( they are found on the classpath ).

Is it best to use a different code pattern or pass some options to the compiler? I would prefer to have the compiler behave the same in release and debug. Possibly you have hit the same issue and have a better pattern to follow.
Registry.zip (7.9 KB)

Disabling optimization in the compile options makes this work, at least as a workaround.

Likely this needs to go to the pas2js team, I am not sure how to write the description to best ensure that it would actually get fixed.

Looks like an issue with the pas2js compiler optimization. We'll report this to the pas2js team.