live2d-widget/rollup.config.js

39 lines
873 B
JavaScript
Raw Normal View History

2022-10-21 12:26:34 +08:00
import { nodeResolve } from "@rollup/plugin-node-resolve";
2022-10-20 17:28:52 +08:00
import { createFilter } from "@rollup/pluginutils";
function string(opts = {}) {
if (!opts.include) {
throw Error("include option should be specified");
}
const filter = createFilter(opts.include, opts.exclude);
return {
name: "string",
transform(code, id) {
if (filter(id)) {
return {
code: `export default ${JSON.stringify(code)};`,
map: { mappings: "" }
};
}
2022-10-21 00:16:05 +08:00
},
renderChunk(code, chunk, outputOptions = {}) {
return `/*!
* Live2D Widget
2023-07-14 10:53:31 +08:00
* https://github.com/510208/live2d-widget
2022-10-21 00:16:05 +08:00
*/
` + code;
2022-10-20 17:28:52 +08:00
}
};
}
export default {
2022-10-21 12:26:34 +08:00
input: "src/waifu-tips.js",
2022-10-20 17:28:52 +08:00
plugins: [nodeResolve(), string({
include: "**/*.svg",
})]
};