My application depends on library which uses ecma6 syntax for modules:
require lib = 'lib.js' // myapp.js
import Foo from 'bar' // lib.js
...
I want to run node myapp.js
, but it results in syntax error, since node does not support ecma6 modules (and --experimental-modules
would require lib.js
to be named lib.mjs
).
Is there any way to run myapp.js
without changing the source code of lib.js
?