Reputation: 10906
I run babel against my source files, i want to output one single file, with all the relative imports injected inside the file.
src
│ index.js
│ relative-file.js
│
└───some-folder
another-relative-file.js
the index file requires relative-file
, and the relative-file
requires another-relative-file
.
index.js
with no relative requires, everything is injected inside this one file.
index.js
with require('./relative-file')
inside.
babel src --out-file distribution/index.js
output a dir will put output multiple files requiring each other just like the source.
babel src --out-dir distribution
Upvotes: 0
Views: 88
Reputation: 976
I don't think babel helps with eliminating requires. You need to use a bundler like webpack in combination with babel to achieve what you want.
Upvotes: 1