rollup/rollup-plugin-babel

[Question]: How to Output All Transpiled Files

martinmckenna opened this issue · 4 comments

Hi I'm wondering how to go about using this plugin so that I can end up with an output like so:

dist/
    index.js
    index.map.js
    someOtherDir/
        a.js
        b.js
    someOtherDir2/
       c.js
       d.js

I'd like to have both the bundled code in the root, while still able to access the transpiled code in their own modules. My goal is to be able to give myself the option to use both of the following import options when using my module:

import { something } from 'my-module';

and

import { something } from 'my-module/someOtherDir/a.js';

Isn't this the opposite of what rollup does? You can directly use @babel/cli, or gulp+gulp-plugin-babel.

^^ yep. and if the answer is "just use the babel cli," that's a perfectly fine answer. I was just hoping there'd be an easy config option to turn on that I'm not seeing.

There is this - https://rollupjs.org/guide/en/#preservemodules

However, you might not like to expose the whole directory structure. I think the best would be to finetune what entries do you want to support and use multiple inputs ( https://rollupjs.org/guide/en/#input ) to output multiple output files. Somewhat achieving what you want but also hiding most of the implementation details.

Pick your poison though :)

Closing because I don't think there is anything actionable on our side here right now.