ES6 modules should be transpiled to AMD modules
jochenberger opened this issue · comments
As Tapestry uses RequireJS, we should output React resources that use the ECMAScript 6 module system as AMD modules. The babel transpiler supports that, so that isn't a problem.
However, there might be a problem if we start running AMD modules through the AMD formatter: babel/babel#2416
We could try to detect the usage of "define", "import" and "export", use the respective options for babel, and force the user to choose a module system if we find both in a single file, but that's probably going to lead to false alerts if the terms are used with a different meaning or inside comments.
The best solution I can come up with right now is to use different file extensions (maybe .jsx
and .jsx6
) and only run the .jsx6
files through the AMD formatter.
As this is about ES6 modules and not about ES6 itself, I'll use .jsxm
as the file extension.