I'm looking for a way to use ES6 Modules (import/export) syntax in my current RequireJS project. I can run my project directly in a recent browser, without build or Babel transformation. I build my project with r.js and Babel only for production.
We would like to start building ES6 modules and use it with requireJS. Is there a way to do that ?
NB : RequireJS does not load dependencies written in ES6.
I'm looking for a way to use ES6 Modules (import/export) syntax in my current RequireJS project. I can run my project directly in a recent browser, without build or Babel transformation. I build my project with r.js and Babel only for production.
We would like to start building ES6 modules and use it with requireJS. Is there a way to do that ?
NB : RequireJS does not load dependencies written in ES6.
Share Improve this question edited Apr 3, 2018 at 14:38 Acidnuk asked Apr 3, 2018 at 13:34 AcidnukAcidnuk 732 silver badges11 bronze badges1 Answer
Reset to default 4Yes, RequireJS should be patible with Babel's es2015-modules-umd plugin. So you should be able to use import
and export
in your files during development with a modern browser that supports modules, then use r.js and Babel w/that plugin for production.