I want to run a js script, that require some ts, and js file in my node project. I use this command node --experimental-modules src/scripts/myScript.js In my myScript.js i can't use import syntax only require is working. So i tend to use require only. But myScript.js is using multiple ts and js files that are using import syntax. Here is the error i got:
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/Users/*****/Desktop/*****/l****/src/scripts/myScript.js:6:22)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)