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