Generate bundle.min.js in Node.js install script (#3794)

This commit is contained in:
Manish Jethani 2021-08-02 04:03:13 +05:30 committed by GitHub
parent 0b764934e0
commit 297bcea49b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -146,6 +146,14 @@ function reset() {
snfe.reset(); snfe.reset();
} }
// rollup.js needs module.exports to be set back to the local exports object.
// This is because some of the code (e.g. publicsuffixlist.js) sets
// module.exports. Once all included files are written like ES modules, using
// export statements, this should no longer be necessary.
if (typeof module !== 'undefined' && typeof exports !== 'undefined') {
module.exports = exports;
}
export { export {
FilteringContext, FilteringContext,
enableWASM, enableWASM,

View File

@ -5,7 +5,7 @@
"type": "module", "type": "module",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"install": "node install.js", "install": "node install.js && rollup main.js --file bundle.min.cjs --format cjs --context global --plugin terser",
"test": "node test.js" "test": "node test.js"
}, },
"repository": { "repository": {
@ -22,5 +22,9 @@
"bugs": { "bugs": {
"url": "https://github.com/gorhill/uBlock/issues" "url": "https://github.com/gorhill/uBlock/issues"
}, },
"homepage": "https://github.com/gorhill/uBlock#readme" "homepage": "https://github.com/gorhill/uBlock#readme",
"dependencies": {
"rollup": "^2.55.1",
"rollup-plugin-terser": "^7.0.2"
}
} }