Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async resolveAssetContents(asset) {
let contents = asset.generated[this.bundle.type]
if (!contents || (contents && contents.path)) {
contents = await fs.readFile(contents ? contents.path : asset.name)
}
console.log(asset.generated)
// Create sub-directories if needed
if (this.bundle.name.includes(path.sep)) {
await fs.mkdirp(path.dirname(this.bundle.name))
}
// Add the hot-reload.js script to background scripts
const json = JSON.parse(contents)
json.background = json.background || {}
json.background.scripts = json.background.scripts || []
json.background.scripts.unshift('hot-reload.js')
contents = JSON.stringify(json)