diff --git a/build.js b/build.js index 721d6f6..4456745 100755 --- a/build.js +++ b/build.js @@ -4,6 +4,8 @@ const esbuild = require('esbuild') const alias = require('esbuild-plugin-alias') const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default +const prod = process.argv.indexOf('prod') !== -1 + esbuild .build({ bundle: true, @@ -21,7 +23,7 @@ esbuild }), nodeGlobals({buffer: true}) ], - sourcemap: 'inline', + sourcemap: prod ? false : 'inline', define: { global: 'window' } diff --git a/package.json b/package.json index 925cb3e..765d390 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,9 @@ "webextension-polyfill": "^0.8.0" }, "scripts": { - "build": "./build.js", + "build": "./build.js prod", "watch": "ag -l --js | entr ./build.js", + "sources": "rm -f extension/*.build.*; zip -r sources . -i extension build.js README.md", "package": "cd extension; zip -r archive *; cd ..; mv extension/archive.zip ./nos2x.zip" } }