mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.48k stars 635 forks source link

Cannot read property 'configure' of undefined #1388

Open notflip opened 2 years ago

notflip commented 2 years ago

I'm trying out nunjucks for the first time, however it seems like there's an issue with the import, this is my code

import nunjucks from 'nunjucks'

class EmailCompiler {
    static compile(html: string, data: {username: string}) {
        nunjucks.configure({autoescape: true})
        return nunjucks.renderString(html, data)
    }
}

export default EmailCompiler

I'm also not receiving any IDE support when I hover the configure or renderString methods, is my method of import faulty?

ogonkov commented 2 years ago

can you create repo to reproduce?