sfc-compiler

raw JSON →
0.7.6 verified Fri May 01 auth: no javascript

A compiler for SFC (Single File Components) that provides rendering capabilities. Version 0.7.6 is the current stable release. Minimal documentation is available; the package is very simple with a single main export. It targets Node.js environments and uses CommonJS. There are no significant differentiators documented.

error TypeError: compiler.render is not a function
cause Calling require('sfc-compiler') returns the module object, not a compiler instance.
fix
Use require('sfc-compiler').createCompiler() to get the compiler instance.
error Error: Cannot find module 'sfc-compiler'
cause Package not installed or not in node_modules.
fix
Run npm install sfc-compiler
gotcha The package uses CommonJS; ES6 imports may not work directly without conversion.
fix Use require() instead of import.
npm install sfc-compiler
yarn add sfc-compiler
pnpm add sfc-compiler

Shows how to create a compiler instance and call render.

const compiler = require('sfc-compiler').createCompiler();
compiler.render();