Syntax Error: Cannot use import statement outside a module
vtrphan opened this issue · 4 comments
vtrphan commented
Hello, i'm getting this error trying to use it in my nestjs/typescript application
...\node_modules\nunjucks-intl\src\nunjucks-intl.js:1
import IntlMessageFormat from 'intl-messageformat';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:999:16)
Please advise
GerritKuilder commented
Yep, met too.... same error.
Dianoga commented
It looks like the package.json
file is pointing main
at index.js
. But that file is explicitly include the file from src
instead of the generated one in dist
.
Dianoga commented
For now I've downgraded to 1.0.0 which is working.
Otherwise if your workflow involves a transpiler (babel or typescript), it's possible to make those also work on this module. It's not ideal though.