Skip to content

Commit

Permalink
🐛 strip @updateURL, @installURL, and @downloadurl directives from pro…
Browse files Browse the repository at this point in the history
…xyScript (#56)

* fix @resource don't support SSRI

* strip @updateURL, @installURL, and @downloadurl directives from proxyScript

* fix lint
  • Loading branch information
yingziwu authored May 17, 2021
1 parent 0ce3fe7 commit 8183575
Show file tree
Hide file tree
Showing 2 changed files with 17,663 additions and 22 deletions.
10 changes: 8 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,19 @@ module.exports = class WebpackUserscript {
const requires = Array.isArray(headerObj.require) ? headerObj.require
: typeof headerObj.require === 'string' ? [headerObj.require]
: []
hotDevHeaderString = userscriptMeta.stringify({
const devHeaderObj = {
...headerObj,
require: [
...requires,
`${hotDevBaseUrl.replace(/\/$/, '')}/${outputFile}`
]
}, this.options.pretty)
}
for (const metakey of ['downloadURL', 'updateURL', 'installURL']) {
if (devHeaderObj[metakey]) {
delete devHeaderObj[metakey]
}
}
hotDevHeaderString = userscriptMeta.stringify(devHeaderObj, this.options.pretty)
compilation.assets[hotDevFilename] = new RawSource(hotDevHeaderString)
}

Expand Down
Loading

0 comments on commit 8183575

Please sign in to comment.