wallet-core/rollup.config.js

160 lines
3.3 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 replace from "@rollup/plugin-replace";
import builtins from "builtin-modules";
import { terser } from "rollup-plugin-terser";
2019-12-02 18:12:59 +01:00
const walletCli = {
input: "dist/node/headless/taler-wallet-cli.js",
2019-12-02 18:12:59 +01:00
output: {
file: "dist/standalone/taler-wallet-cli.js",
format: "cjs",
2019-12-02 18:12:59 +01:00
},
2019-12-16 16:59:09 +01:00
external: builtins,
2019-12-02 18:12:59 +01:00
plugins: [
2020-04-07 11:44:02 +02:00
nodeResolve({
preferBuiltins: true,
}),
commonjs({
2020-04-07 11:44:02 +02:00
include: ["node_modules/**", "dist/node/**"],
extensions: [".js", ".ts"],
ignoreGlobal: false, // Default: false
sourceMap: false,
ignore: ["taler-wallet"],
}),
json(),
],
};
const walletAndroid = {
input: "dist/node/android/index.js",
output: {
file: "dist/standalone/taler-wallet-android.js",
format: "cjs",
exports: "named",
},
external: builtins,
plugins: [
json(),
nodeResolve({
preferBuiltins: true,
}),
2019-12-02 18:12:59 +01:00
commonjs({
include: ["node_modules/**", "dist/node/**"],
extensions: [".js"],
ignoreGlobal: false, // Default: false
2019-12-02 18:12:59 +01:00
sourceMap: false,
ignore: ["taler-wallet"],
2019-12-16 16:59:09 +01:00
}),
],
};
2019-12-16 16:59:09 +01:00
const webExtensionPageEntryPoint = {
input: "dist/node/webex/pageEntryPoint.js",
output: {
file: "dist/webextension/pageEntryPoint.js",
format: "iife",
exports: "default",
name: "webExtensionPageEntry",
},
external: builtins,
plugins: [
2019-12-16 16:59:09 +01:00
json(),
nodeResolve({
preferBuiltins: true,
}),
terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
}),
commonjs({
include: ["node_modules/**", "dist/node/**"],
extensions: [".js"],
ignoreGlobal: false, // Default: false
sourceMap: false,
ignore: ["taler-wallet"],
}),
],
2019-12-02 18:12:59 +01:00
};
const webExtensionBackgroundPageScript = {
input: "dist/node/webex/background.js",
2019-12-05 19:38:19 +01:00
output: {
file: "dist/webextension/background.js",
format: "iife",
exports: "default",
name: "webExtensionBackgroundScript",
2019-12-05 19:38:19 +01:00
},
2019-12-16 16:59:09 +01:00
external: builtins,
2019-12-05 19:38:19 +01:00
plugins: [
json(),
nodeResolve({
preferBuiltins: true,
}),
terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
2019-12-05 19:38:19 +01:00
}),
commonjs({
include: ["node_modules/**", "dist/node/**"],
extensions: [".js"],
ignoreGlobal: false, // Default: false
2019-12-05 19:38:19 +01:00
sourceMap: false,
ignore: ["taler-wallet", "crypto"],
}),
],
};
const webExtensionCryptoWorker = {
input: "dist/node/crypto/workers/browserWorkerEntry.js",
output: {
file: "dist/webextension/browserWorkerEntry.js",
format: "iife",
exports: "default",
name: "webExtensionCryptoWorker",
},
external: builtins,
plugins: [
json(),
nodeResolve({
preferBuiltins: true,
}),
terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
}),
commonjs({
include: ["node_modules/**", "dist/node/**"],
extensions: [".js"],
ignoreGlobal: false, // Default: false
sourceMap: false,
ignore: ["taler-wallet", "crypto"],
}),
],
};
export default [
walletCli,
walletAndroid,
webExtensionPageEntryPoint,
webExtensionBackgroundPageScript,
webExtensionCryptoWorker,
];