How to use the @lwc/template-compiler.compileToFunction function in @lwc/template-compiler

To help you get started, we’ve selected a few @lwc/template-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / @lwc / engine / scripts / jest / test-utils.js View on Github external
function compileTemplate(source, config = {}) {
    const { modules = {} } = config;

    // Check if the same template has already been compiled
    if (!(source in TEMPLATE_CACHE)) {
        TEMPLATE_CACHE[source] = compileToFunction(source);
    }

    const templateFactory = TEMPLATE_CACHE[source];
    return registerTemplate(templateFactory(modules));
}

@lwc/template-compiler

Template compiler package

MIT
Latest version published 2 days ago

Package Health Score

90 / 100
Full package analysis