最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to integrate ES6 Module syntax in RequireJS project - Stack Overflow

programmeradmin0浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 4

Yes, 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.

发布评论

评论列表(0)

  1. 暂无评论