@@ -96,27 +96,6 @@ if (process.env.DOCKER_COMMIT_HASH) {
9696 }
9797}
9898
99- // HACK -- Ordpool: cache-bust config.js / customize.js by appending
100- // `?v=<gitCommitHash>` to their <script src> in index.html. These files
101- // aren't fingerprinted (Angular only hashes its own bundles), so without
102- // the query suffix the browser keeps reading the previous build's
103- // window.__env until /resources/config.js's max-age expires. Same trick
104- // Angular uses for its bundle filenames -- different URL per deploy
105- // forces a fresh fetch; matching ETag still 304's when content is
106- // unchanged.
107- try {
108- const stamp = gitCommitHash || Date . now ( ) . toString ( 36 ) ;
109- let indexHtml = fs . readFileSync ( 'src/index.html' , 'utf-8' ) ;
110- indexHtml = indexHtml . replace (
111- / < s c r i p t \s + s r c = " \/ r e s o u r c e s \/ ( c o n f i g | c u s t o m i z e ) \. j s (?: \? [ ^ " ] * ) ? " > < \/ s c r i p t > / g,
112- `<script src="/resources/$1.js?v=${ stamp } "></script>` ,
113- ) ;
114- fs . writeFileSync ( 'src/index.html' , indexHtml ) ;
115- console . log ( `Cache-busted /resources/{config,customize}.js in src/index.html with v=${ stamp } ` ) ;
116- } catch ( e ) {
117- console . log ( 'Warning: could not cache-bust resources/config.js in index.html:' , e . message ) ;
118- }
119-
12099const newConfig = `(function (window) {
121100 window.__env = window.__env || {};${ settings . reduce ( ( str , obj ) => `${ str }
122101 window.__env.${ obj . key } = ${ typeof obj . value === 'string' ? `'${ obj . value } '` : obj . value } ;` , '' ) }
0 commit comments