9
0
mirror of https://github.com/donlon/cloudflare-error-page.git synced 2025-12-22 16:29:29 +00:00
Files
cloudflare-error-page/javascript/rollup.config.ts
2025-12-22 23:46:21 +08:00

36 lines
794 B
TypeScript

import typescript from "@rollup/plugin-typescript";
import { createFilter } from "@rollup/pluginutils";
// import pkg from './package.json' with { type: 'json' };
function createRawImportPlugin(include: string) {
const rawFilter = createFilter(include);
return {
name: "raw-import",
transform(code: string, id: string): any {
if (rawFilter(id)) {
return {
code: `export default ${JSON.stringify(code)};`,
map: { mappings: "" },
};
}
},
};
}
export default {
input: "src/index.ts",
output: {
// file: pkg.module,
file: "dist/index.js",
format: "esm",
sourcemap: true,
},
watch: {
include: "src/**",
},
external: ["ejs"],
plugins: [typescript(), createRawImportPlugin("**/templates/**")],
};