-
Notifications
You must be signed in to change notification settings - Fork 1
ECMAScript Modules
CodeEngine currently uses CommonJS modules (i.e. require()) rather than ECMAScript modules (i.e. import) because ECMAScript modules are still an experimental feature of Node.js and are not fully implemented or supported yet.
One of CodeEngine's design goals is to fully leverage modern JavaScript features and syntax. So we look forward to adopting ECMAScript modules as soon as they are fully-implemented in Node and supported by CodeEngine's major dependencies.
We recommend that you write your CodeEngine generators and plugins in TypeScript, which is natively supported by CodeEngine. This allows you to use modern ECMAScript syntax like import and export, and you don't even need a build step to transpile your code to CommonJS. CodeEngine will handle that for you. This also means that when CodeEngine eventually switches to ECMAScript modules internally, you won't need to change anything.
Another option is to write your CodeEngine generators and plugins using ECMAScript module syntax and use a tool like Babel, Rollup, or Webpack to transpile your code to CommonJS syntax.
Another option is to write your CodeEngine generators and plugins in CommonJS syntax, using module.exports and require() instead of export and import. No extra build or transpile step is needed.
Customization
API Reference

