连接在babeljs中的模块中导入 [英] Concatenate imports in modules in babeljs

查看:106
本文介绍了连接在babeljs中的模块中导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有办法连接脚本与中导入的脚本? babelJS



我有以下



home.js import home / home-导航栏和home / home滑块



我希望输出包含home / home-navbar和home / home-slider,但将它们全部放在一个文件中home.js



我可以在BabelJS中执行此操作吗?如果不是这样做的正确方法?

解决方案


我可以这样做吗BabelJS?


否,还没有


正确的方法是什么?


不确定正确的方法,但有其他选择。 browserify esperanto 计算模块依赖关系,并将它们捆绑成一个文件(如果需要的话可以是多个)。



根据具体的用例,您还可以编写一个连接起来的简单脚本所有档案。


I am new to all ES6 transpiling and I was planning on using BabelJS.

Is there a way to concatenate scripts with there imports in babelJS

I have the following

home.js imports home/home-navbar and home/home-slider

I want the output to contain both home/home-navbar and home/home-slider but put them all in one file home.js

Can I do this in BabelJS? and if not what would be the proper way to do it?

解决方案

Can I do this in BabelJS?

No, not yet.

what would the proper way to do it?

Not sure about the proper way, but there are alternatives. Tools like browserify and esperanto compute module dependencies and bundle them into a single files (or multiple if desired).

Depending on your specific use case you could also write a simple script that concatenates all files.

这篇关于连接在babeljs中的模块中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆