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

104 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-12-02 18:12:59 +01:00
// rollup.config.js
import linaria from '@linaria/rollup';
import alias from '@rollup/plugin-alias';
import commonjs from "@rollup/plugin-commonjs";
import image from '@rollup/plugin-image';
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
2020-08-10 18:49:23 +02:00
import replace from "@rollup/plugin-replace";
2021-07-10 04:15:49 +02:00
import css from 'rollup-plugin-css-only';
import ignore from "rollup-plugin-ignore";
2021-06-14 19:38:17 +02:00
const makePlugins = () => [
2021-07-10 04:15:49 +02:00
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom', replacement: 'preact/compat' }
]
}),
2021-06-14 19:38:17 +02:00
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-07-10 04:15:49 +02:00
linaria({
sourceMap: process.env.NODE_ENV !== 'production',
}),
css({
output: 'styles.css',
}),
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,
];