diff options
Diffstat (limited to 'packages/taler-wallet-webextension/rollup.config.js')
-rw-r--r-- | packages/taler-wallet-webextension/rollup.config.js | 78 |
1 files changed, 26 insertions, 52 deletions
diff --git a/packages/taler-wallet-webextension/rollup.config.js b/packages/taler-wallet-webextension/rollup.config.js index 6f2d84509..30ca82a0b 100644 --- a/packages/taler-wallet-webextension/rollup.config.js +++ b/packages/taler-wallet-webextension/rollup.config.js @@ -6,33 +6,41 @@ import builtins from "builtin-modules"; import replace from "@rollup/plugin-replace"; import ignore from "rollup-plugin-ignore" - -const webExtensionPageEntryPoint = { - input: "lib/pageEntryPoint.js", - output: { - file: "dist/pageEntryPoint.js", - format: "iife", - exports: "none", - name: "webExtensionPageEntry", - }, - plugins: [ - json(), - - ignore(builtins), - +const makePlugins = () => [ + ignore(["module", "os"]), nodeResolve({ browser: true, + preferBuiltins: true, }), //terser(), + replace({ "process.env.NODE_ENV": JSON.stringify("production"), "__filename": "'__webextension__'", }), - commonjs(), - ], + commonjs({ + include: [/node_modules/, /dist/], + extensions: [".js"], + ignoreGlobal: true, + sourceMap: true, + }), + + json(), +]; + + +const webExtensionPageEntryPoint = { + input: "lib/pageEntryPoint.js", + output: { + file: "dist/pageEntryPoint.js", + format: "iife", + exports: "none", + name: "webExtensionPageEntry", + }, + plugins: makePlugins(), }; const webExtensionBackgroundPageScript = { @@ -43,24 +51,7 @@ const webExtensionBackgroundPageScript = { exports: "none", name: "webExtensionBackgroundScript", }, - plugins: [ - json(), - - ignore(builtins), - - nodeResolve({ - browser: true, - }), - - //terser(), - - replace({ - "process.env.NODE_ENV": JSON.stringify("production"), - "__filename": "'__webextension__'", - }), - - commonjs() - ], + plugins: makePlugins(), }; const webExtensionCryptoWorker = { @@ -71,24 +62,7 @@ const webExtensionCryptoWorker = { exports: "none", name: "webExtensionCryptoWorker", }, - plugins: [ - json(), - - ignore(builtins), - - nodeResolve({ - browser: true, - }), - - //terser(), - - replace({ - "process.env.NODE_ENV": JSON.stringify("production"), - "__filename": "'__webextension__'", - }), - - commonjs(), - ], + plugins: makePlugins(), }; export default [ |