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 +- pnpm-lock.yaml | 17 +---- 4 files changed, 31 insertions(+), 70 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 [ 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 { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c02ed18dd..14219b2f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,6 @@ importers: '@types/node': ^14.14.22 ava: ^3.15.0 esbuild: ^0.9.2 - esm: ^3.2.25 jed: ^1.1.1 prettier: ^2.2.1 rimraf: ^3.0.2 @@ -59,7 +58,6 @@ importers: '@types/node': 14.14.34 ava: 3.15.0 esbuild: 0.9.2 - esm: 3.2.25 prettier: 2.2.1 rimraf: 3.0.2 typescript: 4.2.3 @@ -159,7 +157,6 @@ importers: eslint-plugin-jsx-a11y: ^6.4.1 eslint-plugin-react: ^7.22.0 eslint-plugin-react-hooks: ^4.2.0 - esm: ^3.2.25 fflate: ^0.6.0 jed: ^1.1.1 nyc: ^15.1.0 @@ -195,7 +192,6 @@ importers: eslint-plugin-jsx-a11y: 6.4.1_eslint@7.18.0 eslint-plugin-react: 7.22.0_eslint@7.18.0 eslint-plugin-react-hooks: 4.2.0_eslint@7.18.0 - esm: 3.2.25 jed: 1.1.1 nyc: 15.1.0 po2json: 0.4.5 @@ -6165,7 +6161,7 @@ packages: /axios/0.21.1: resolution: {integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==} dependencies: - follow-redirects: 1.14.0 + follow-redirects: 1.14.0_debug@4.3.1 transitivePeerDependencies: - debug @@ -9660,15 +9656,6 @@ packages: readable-stream: 2.3.7 dev: true - /follow-redirects/1.14.0: - resolution: {integrity: sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - /follow-redirects/1.14.0_debug@4.3.1: resolution: {integrity: sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==} engines: {node: '>=4.0'} @@ -9679,7 +9666,6 @@ packages: optional: true dependencies: debug: 4.3.1_supports-color@6.1.0 - dev: true /for-each/0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -13250,6 +13236,7 @@ packages: /nodent-compiler/3.2.13: resolution: {integrity: sha512-nzzWPXZwSdsWie34om+4dLrT/5l1nT/+ig1v06xuSgMtieJVAnMQFuZihUwREM+M7dFso9YoHfDmweexEXXrrw==} + engines: {'0': n, '1': o, '2': d, '3': e, '4': ' ', '5': '>', '6': '=', '7': ' ', '8': '0', '9': ., '10': '1', '11': '0', '12': ., '13': '0'} dependencies: acorn: 5.7.4 acorn-es7-plugin: 1.1.7 -- cgit v1.2.3