wallet-core/packages/taler-wallet-webextension/rollup.config.js

87 lines
1.8 KiB
JavaScript
Raw Normal View History

2019-12-02 18:12:59 +01:00
// rollup.config.js
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import json from "@rollup/plugin-json";
import builtins from "builtin-modules";
2020-08-10 18:49:23 +02:00
import replace from "@rollup/plugin-replace";
import ignore from "rollup-plugin-ignore"
2021-06-21 01:37:35 +02:00
import image from '@rollup/plugin-image';
2021-06-14 19:38:17 +02:00
const makePlugins = () => [
ignore(["module", "os"]),
nodeResolve({
2020-08-10 18:49:23 +02:00
browser: true,
2021-06-14 19:38:17 +02:00
preferBuiltins: true,
}),
2020-08-10 18:49:23 +02:00
//terser(),
2021-06-14 19:38:17 +02:00
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
2020-08-10 18:49:23 +02:00
"__filename": "'__webextension__'",
}),
2021-06-14 19:38:17 +02:00
commonjs({
include: [/node_modules/, /dist/],
extensions: [".js"],
ignoreGlobal: true,
sourceMap: true,
}),
json(),
2021-06-21 01:37:35 +02:00
image(),
2021-06-14 19:38:17 +02:00
];
2021-06-16 22:01:06 +02:00
const webExtensionWalletEntryPoint = {
input: "lib/walletEntryPoint.js",
2021-06-14 19:38:17 +02:00
output: {
2021-06-16 22:01:06 +02:00
file: "dist/walletEntryPoint.js",
2021-06-14 19:38:17 +02:00
format: "iife",
exports: "none",
2021-06-16 22:01:06 +02:00
name: "webExtensionWalletEntry",
},
plugins: makePlugins(),
};
const webExtensionPopupEntryPoint = {
input: "lib/popupEntryPoint.js",
output: {
file: "dist/popupEntryPoint.js",
format: "iife",
exports: "none",
name: "webExtensionPopupEntry",
2021-06-14 19:38:17 +02:00
},
plugins: makePlugins(),
2019-12-02 18:12:59 +01:00
};
const webExtensionBackgroundPageScript = {
2020-08-10 18:49:23 +02:00
input: "lib/background.js",
2019-12-05 19:38:19 +01:00
output: {
2020-08-10 18:49:23 +02:00
file: "dist/background.js",
format: "iife",
exports: "none",
name: "webExtensionBackgroundScript",
2019-12-05 19:38:19 +01:00
},
2021-06-14 19:38:17 +02:00
plugins: makePlugins(),
};
const webExtensionCryptoWorker = {
2020-08-10 18:49:23 +02:00
input: "lib/browserWorkerEntry.js",
output: {
2020-08-10 18:49:23 +02:00
file: "dist/browserWorkerEntry.js",
format: "iife",
exports: "none",
name: "webExtensionCryptoWorker",
},
2021-06-14 19:38:17 +02:00
plugins: makePlugins(),
};
export default [
2021-06-16 22:01:06 +02:00
webExtensionPopupEntryPoint,
webExtensionWalletEntryPoint,
webExtensionBackgroundPageScript,
webExtensionCryptoWorker,
];