-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crx loader broken due to Chrome 130 (#1617)
- Loading branch information
1 parent
13b2eaa
commit 3e75456
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"fuels-wallet": patch | ||
--- | ||
|
||
fix chrome runtim loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { writeFileSync } from 'node:fs'; | ||
import { join } from 'node:path'; | ||
import type { Plugin } from 'vite'; | ||
|
||
type FixCRXPlugin = { | ||
outDir?: string; | ||
}; | ||
|
||
export const fixCRXBuildPlugin = ({ outDir }: FixCRXPlugin) => { | ||
const plugin: Plugin = { | ||
name: 'fix-crx-plugin', | ||
apply: 'build', | ||
closeBundle: async () => { | ||
const manifestPath = join(__dirname, '..', outDir, '/manifest.json'); | ||
console.log(manifestPath); | ||
console.log(outDir); | ||
const manifest = require(manifestPath); | ||
const webAccessibleResources = manifest.web_accessible_resources; | ||
|
||
const updatedWebAccessibleResources = webAccessibleResources.map( | ||
(resource) => { | ||
if (resource.use_dynamic_url) { | ||
return { | ||
...resource, | ||
use_dynamic_url: false, | ||
}; | ||
} | ||
return resource; | ||
} | ||
); | ||
manifest.web_accessible_resources = updatedWebAccessibleResources; | ||
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf8'); | ||
}, | ||
}; | ||
return plugin; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters