2022-10-21 04:26:34 +00:00
|
|
|
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
2022-10-20 09:28:52 +00: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-20 16:16:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
renderChunk(code, chunk, outputOptions = {}) {
|
|
|
|
return `/*!
|
|
|
|
* Live2D Widget
|
|
|
|
* https://github.com/stevenjoezhang/live2d-widget
|
|
|
|
*/
|
|
|
|
` + code;
|
2022-10-20 09:28:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2022-10-21 04:26:34 +00:00
|
|
|
input: "src/waifu-tips.js",
|
2022-10-20 09:28:52 +00:00
|
|
|
plugins: [nodeResolve(), string({
|
|
|
|
include: "**/*.svg",
|
|
|
|
})]
|
|
|
|
};
|