File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,22 @@ const { SourceMapDevToolPlugin } = require('webpack');
33const { merge } = require ( 'webpack-merge' ) ;
44const common = require ( './webpack.common.js' ) ;
55
6- function createGHPSourceMapURL ( env ) {
6+ async function createGHPSourceMapURL ( env ) {
77 const manifest = require ( "../manifest/manifest.json" ) ;
88 const version = manifest . version ;
99 const [ owner , repo_name ] = ( process . env . GITHUB_REPOSITORY ?? "ajayyy/SponsorBlock" ) . split ( "/" ) ;
10- return `https://${ owner . toLowerCase ( ) } .github.io/${ repo_name } /${ env . browser } ${ env . stream === "beta" ? "-beta" : "" } /${ version } /` ;
10+ const ghpUrl = `https://${ owner . toLowerCase ( ) } .github.io/${ repo_name } /${ env . browser } ${ env . stream === "beta" ? "-beta" : "" } /${ version } /` ;
11+ // make a request to the url and check if we got redirected
12+ // firefox doesn't seem to like getting redirected on a source map request
13+ try {
14+ const resp = await fetch ( ghpUrl ) ;
15+ return resp . url ;
16+ } catch {
17+ return ghpUrl ;
18+ }
1119}
1220
13- module . exports = env => {
21+ module . exports = async env => {
1422 let mode = "production" ;
1523 env . mode = mode ;
1624
@@ -20,7 +28,7 @@ module.exports = env => {
2028 ? {
2129 devtool : false ,
2230 plugins : [ new SourceMapDevToolPlugin ( {
23- publicPath : createGHPSourceMapURL ( env ) ,
31+ publicPath : await createGHPSourceMapURL ( env ) ,
2432 filename : '[file].map[query]' ,
2533 } ) ] ,
2634 }
You can’t perform that action at this time.
0 commit comments