KSDaemon / nunjucks-intl

Nunjucks helpers for internationalization.
http://formatjs.io/nunjucks/
BSD 3-Clause "New" or "Revised" License
11 stars 8 forks source link

Syntax Error: Cannot use import statement outside a module #47

Closed vtrphan closed 2 years ago

vtrphan commented 4 years ago

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 4 years ago

Yep, met too.... same error.

Dianoga commented 3 years ago

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.

vtrphan commented 3 years ago

@Dianoga is correct, pls fix it

Dianoga commented 3 years ago

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.