I'm trying to bundle everything into one single file with rollupjs.
main.js file:
import * as ex from 'example-export';
ex.alertMe();
example-export.js file:
export function alertMe() {
alert('alert!');
};
The command below and it's response:
karl@karl-ux303ln:~/dev/sketch/experiment/socketio$ rollup ./public/js/main.js --output ./public/js/bundle.js --format iife --sourcemap inline
Treating 'example-export' as external dependency
No name was provided for external module 'example-export' in options.globals – guessing 'ex'
The bundle.js file produced:
(function (ex) {
'use strict';
ex.alertMe();
}(ex));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmpzIiwic291cmNlcyI6WyJtYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGV4IGZyb20gJ2V4YW1wbGUtZXhwb3J0JztcblxuZXguYWxlcnRNZSgpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxFQUFFLENBQUMsT0FBTyxFQUFFLDs7In0=
I was expecting the example-export module to be included in the bundle.js file. Since this is really new stuff the internet lacks proper examples of this.
I expect the issue has something to do with the --name argument https://github.com/rollup/rollup/wiki/Command-Line-Interface#usage. I cannot however figure out how it's supposed to be used. And let's say if I have multiple exports and imports, how will that look?