From 4b16d7bd342dbb5376fd2cef08b14ebabbe4ed10 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Jun 2021 19:38:17 +0200 Subject: fix module bundling config --- .../taler-wallet-webextension/rollup.config.js | 78 ++++++++-------------- .../taler-wallet-webextension/src/i18n/index.ts | 2 +- .../src/pageEntryPoint.ts | 4 +- 3 files changed, 29 insertions(+), 55 deletions(-) (limited to 'packages') 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 [ diff --git a/packages/taler-wallet-webextension/src/i18n/index.ts b/packages/taler-wallet-webextension/src/i18n/index.ts index abfc8b925..8db366a35 100644 --- a/packages/taler-wallet-webextension/src/i18n/index.ts +++ b/packages/taler-wallet-webextension/src/i18n/index.ts @@ -21,4 +21,4 @@ /** * Imports. */ -export { strings } from "./strings"; +export { strings } from "./strings.js"; diff --git a/packages/taler-wallet-webextension/src/pageEntryPoint.ts b/packages/taler-wallet-webextension/src/pageEntryPoint.ts index 960b19950..505b32d71 100644 --- a/packages/taler-wallet-webextension/src/pageEntryPoint.ts +++ b/packages/taler-wallet-webextension/src/pageEntryPoint.ts @@ -22,8 +22,8 @@ import { render } from "preact"; import { setupI18n } from "@gnu-taler/taler-util"; -import { strings } from "./i18n" -import { Application } from './Application'; +import { strings } from "./i18n/strings"; +import { Application } from "./Application"; function main(): void { try { -- cgit v1.2.3