Open gvrancken opened 3 years ago
The import
statement works only if your code is an ES module. This can be done either by putting the "type": "module"
in your package.json
, or by using the .mjs
file extension instead of .js
.
@gvrancken I've made a simplified version that doesn't use modules (as I don't understand them 😆 ) https://github.com/murkle/dgtchess/blob/main/README.md
(using Node 16) When using with node an the supplied example
we get the error:
SyntaxError: Cannot use import statement outside a module
If we add
"type": "module"
to our package.json, we then get the error:Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:
How can we fix this?