Import/export syntax

Enonic version: 7.11.0
OS: Ubuntu 20.04.05 LTS

Is it possible to use the import/export syntax in Enonic? If so, how can I do it?

Hi,

If you base your project on the webpack-starter, webpack can transpile from module-syntax (import/export) to commonjs-syntax (require).

XP needs CommonJS because of the Nashorn JS-engine it run JavaScript on.

Personally I use the webpack-starter for all my projects, and my code is written in TypeScript.

– Tom

1 Like