I use ExtJS together with Grails. I have already two ExtJS applications in that project and now I want to add a third one.
The new application runs fine in development mode, but when I am starting it in production mode and then try to open it in the browser the screen stay white and the chrome console tells me that the bootstrap.js is missing in the production build folder. Which is true, there is no such file. First I looked for a configuration to add this file when building in prod, but then I noticed that in the other two working application, that I already have, there is no bootstrap.js file either in the production build. Instead there are microloader.js files. Unfortunately I wasn't the one who set those ext applications up,so I don't know the reason for that.
Then another difference I noticed between my new not working application to the two working ones was in the index.gsp files.
The new one:
<g:if env="production">
<base href="../path">
<script id="microloader" data-app="1234..." type="text/javascript"
src="bootstrap.js"></script>
</g:if>
<g:else>
<base href="..path">
<script id="microloader" data-app="1234..." type="text/javascript"
src="bootstrap.js"></script>
</g:else>
And one of the working ones:
<g:if env="production">
<base href="../path/">
<script id="microloader" data-app="4321..." src="microloader.js"></script>
</g:if>
<g:else>
<base href="../path/">
<script id="microloader" data-app="4321..." type="text/javascript" src="bootstrap.js">
</script>
</g:else>
Changing the new index.gsp accordingly only leads to microloader.js being missed instead of the bootstrap.js
Another thing that I noticed is that the index.html which is created in the build folders look different.
The old ones look very plain and basic and in the new one there is lots of code, which seems to be equivalent with the code that is in the microloader.js files in the working apps.
I have the following assumptions:
Is here maybe anyone who had a similar problem or has any idea how to solve this problem?
I am using ExtJS 7.5.1 in the old and the new applications. But the new one uses the modern toolkit instead of the old ones who are using the classic toolkit. Grails 2.5.6 is used.
Please let me know, if you need any other info.
Thank you very much in advance.
I was able to figure it out. My third assumption was correct and the second one probably as well. Per default the microloader.js is added to the index.html. Since in my case I use the index.gsp, we have to add a configuration to tell sencha, that it writes the microloader into a seperate file. The configuration is in the app.json and looks like this:
"production": {
"output": {
"microloader": {
"embed": false
},
"appCache": {
"enable": false,
"path": "cache.appcache"
}
},
"loader": {
"cache": "${build.timestamp}"
},
"cache": {
"enable": true
},
"compressor": {
"type": "yui"
}
}
The important bit here is this:
"microloader": {
"embed": false
},
When this configuration is added and we run "sencha app build" again, then there will be a seperate file microloader.js And then I can change the new index.gsp to look like the index.gsp files of the old applications.
I hope this will help someone in the future.
Best regards