I'm trying to generate JS files using Mustache templating. I'm using NodeJS and want to create a JS file to make development during React projects faster. Now I've created below template:
export { default } from "./{{componentName}};
And I'm using it like this:
import index from "./templates/components/index.mustache";
fs.appendFile(
`./src/components/${componentType}s/${componentNameWithoutCapitals}/index.ts`,
mustache.render(index, { componentName: componentNameWithoutCapitals }),
(err) => err && console.log(err)
);
I though Mustache would just render a string, and fill in the values which I pass via the object in the parameter. I get an error stating it can't find a module:
Error: Cannot find module './{{componentName}}'
Does someone know how I should proceed?