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
|
|
|
|
2019-12-16 16:59:09 +01:00
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
const webExtensionPageEntryPoint = {
|
2020-08-10 18:49:23 +02:00
|
|
|
input: "lib/pageEntryPoint.js",
|
2020-04-06 17:35:51 +02:00
|
|
|
output: {
|
2020-08-10 18:49:23 +02:00
|
|
|
file: "dist/pageEntryPoint.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: "webExtensionPageEntry",
|
|
|
|
},
|
|
|
|
plugins: [
|
2019-12-16 16:59:09 +01:00
|
|
|
json(),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
ignore(builtins),
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
nodeResolve({
|
2020-08-10 18:49:23 +02:00
|
|
|
browser: true,
|
2020-04-06 17:35:51 +02:00
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
//terser(),
|
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
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
commonjs(),
|
2020-04-06 17:35:51 +02:00
|
|
|
],
|
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
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
ignore(builtins),
|
|
|
|
|
2019-12-05 19:38:19 +01:00
|
|
|
nodeResolve({
|
2020-08-10 18:49:23 +02:00
|
|
|
browser: true,
|
2020-04-06 17:35:51 +02:00
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
//terser(),
|
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__'",
|
2019-12-05 19:38:19 +01:00
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
commonjs()
|
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",
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
ignore(builtins),
|
|
|
|
|
2020-04-06 17:35:51 +02:00
|
|
|
nodeResolve({
|
2020-08-10 18:49:23 +02:00
|
|
|
browser: true,
|
2020-04-06 17:35:51 +02:00
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
//terser(),
|
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
|
|
|
}),
|
|
|
|
|
2020-08-10 18:49:23 +02:00
|
|
|
commonjs(),
|
2020-04-06 17:35:51 +02:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default [
|
|
|
|
webExtensionPageEntryPoint,
|
|
|
|
webExtensionBackgroundPageScript,
|
|
|
|
webExtensionCryptoWorker,
|
|
|
|
];
|