diff options
author | Florian Dold <florian@dold.me> | 2021-06-14 19:38:17 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-14 19:38:17 +0200 |
commit | 4b16d7bd342dbb5376fd2cef08b14ebabbe4ed10 (patch) | |
tree | 50679e046eef7d184fc1bdf1adb803156b79172d /packages/taler-wallet-webextension | |
parent | ef636c022bb6f8017ef237a5e6468f5c449665ad (diff) |
fix module bundling config
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r-- | packages/taler-wallet-webextension/rollup.config.js | 78 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/i18n/index.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/pageEntryPoint.ts | 4 |
3 files changed, 29 insertions, 55 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 { |