Ext JS - on sencha production build, sencha cmd is removing extra attribute in index.html file

348 Views Asked by At

For Content security policy, I have added nonce to microloader script tag to bypass the inline script generated when index.html is re-written after production build as below

script id="microloader" nonce="random" data-app="random-app" type="text/javascript" src="bootstrap.js"

but I have observed the nonce="random" getting strip after the sencha build(production).
Because of this, csp is through an error for the inline JS that is imbedded in between script tag.

How can I stop sencha removing the added nonce?

2

There are 2 best solutions below

1
On

Which file are you updating?build\production\SenchaApp.. Don't update this because it always rewrites by the sencha cmd. Better to update root level index.html then build again

0
On

I would suggest making use of the --after-build target in the build.xml ant script. From there you could manually edit/update the build's index.html to insert the nonce attribute automatically into the script tag.