anki/ts/rollup.config.js
Damien Elmes f248b71707 sanitize deck description HTML with html-sanitize
Committing for reference; will roll back afterwards.

This adds approximately 150k to the bundled .js file in release mode.
html-sanitizer might be useful to replace our custom paste filtering
code in the future, but for now I'm not sure it's worth the extra
page load time over doing the filtering in Rust.
2021-02-06 13:25:34 +10:00

34 lines
898 B
JavaScript

import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import ignore from "rollup-plugin-ignore";
import { terser } from "rollup-plugin-terser";
import process from "process";
const production = process.env["COMPILATION_MODE"] === "opt";
export default {
external: ["protobufjs/light"],
output: {
globals: {
"protobufjs/light": "protobuf",
},
name: "anki",
},
plugins: [
resolve({
browser: true,
dedupe: ["svelte", "protobufjs"],
}),
json(),
commonjs(),
// imported by sanitize-html->postcss
ignore(["path", "url"]),
production && terser(),
],
onwarn: function (warning, warn) {
if (warning.code === "CIRCULAR_DEPENDENCY") return;
throw warning;
},
};