How can I make Development builds behave the same as Testing and Production?

為{幸葍}努か 提交于 2019-12-24 07:44:50

问题


When developing an app I have sencha app watch running. This, of course, watches for file changes and triggers a development build. So now I can exercise the app under development in the browser. Nice.

The problem is a sencha app build testing does not behave the same way as the Development build. The difference is in needing requires. If a requires is missing in Development, the app functions as if it was there.

Chrome throws a warning - sometimes:

[W] [Ext.Loader] Synchronously loading 'MyApp.view.Etc'; consider adding Ext.require('MyApp.view.Etc') above Ext.onReady 

After a Testing build (or similarly after a Production build), those warnings become errors and the app does not function.

Yes, during development time one should ensure all requires are added. But if I miss one I'm in trouble - the painful "but it works on my machine" syndrome.

This would not be a problem if either I could tell sencha app watch to not be forgiving of missing requires or to tell sencha app build testing (or production) to do what the Development build does and infer the missing requires.

How can I make Development builds behave the same as Testing and Production?


回答1:


You cannot tell sencha app build production to infer the missing requires, because Sencha only finds out that some required classes are missing AT RUNTIME, when the source code of your JS files should not be available at the path that the application would start searching. It's a runtime error, not a compiler error.

So you can only do it the other way around: you can edit the ExtJS source code. The warning is raised in packages\core\src\class\ClassManager.js like this:

Ext.log.warn("[Ext.Loader] Synchronously loading '" + name + "'; consider adding " +
                 "Ext.require('" + name + "') above Ext.onReady");

You could change that to

Ext.raise("[Ext.Loader] Synchronously loading '" + name + "'; please add " +
                 "'" + name + "' to your requires list");


来源:https://stackoverflow.com/questions/40680425/how-can-i-make-development-builds-behave-the-same-as-testing-and-production

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!