Error: Cannot use import statement outside a module
tobiasdiez opened this issue · 10 comments
When used with graphql-codegen-esm, the following error is triggered:
(node:2159) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
[FAILED]
[FAILED] Unable to load template plugin matching 'typescript-validation-schema'.
[FAILED] Reason:
[FAILED] Cannot use import statement outside a module
[FAILED]
This error occurs in 0.14.1, but 0.12.1 was working well. See update PR JabRef/JabRefOnline#2382
@tobiasdiez Thanks for your report!
Do you have any plans to resolve this issue?
Probably, Do I need to modify type in package.json?
This is a problem for me as well.
As mentioned before, I was only able to get around this by downgrading to 0.12.1.
Could anyone give me a minimal reproduction for this?
Any updates on this? This is a breaking bug for production usage, what's the recommended workaround, just using the older version @Code-Hex ?
@itpropro Could you give me a minimal reproduction for this? So I can fix this issue
@itpropro Could you give me a minimal reproduction for this? So I can fix this issue
Of course, I thought you already had one. It's basically happening when graphql-codegen-esm is used with this plugin. I will try to create a stackblitz repro asap!
EDIT: Here is the reproduction on StackBlitz https://stackblitz.com/edit/graphql-code-generator-graphql-esm-compatibility-5wdrqb?file=package.json
If you switch the version to 0.12.1, it will work.
@Code-Hex Thank you very much. I can confirm this is fixed! 😃