Converts text files to modules:
import tpl from "./tpl.html";
console.log(`Template for render: ${tpl}`);
npm i rollup-plugin-string -D
import { rollup } from "rollup";
import { string } from "rollup-plugin-string";
rollup({
entry: "main.js",
plugins: [
string({
// Required to be specified
include: "**/*.html",
// Undefined by default
exclude: ["**/index.html"]
})
]
});
MIT © Bogdan Chadkin