In the past I\'ve used the revealing module pattern.
function myModule() {
function foo() ...
function bar() ...
return {
foo: foo,
bar: bar
}
I read all the time that default exports are preferred
No, they are not. They are simpler and have shorter syntax, and might be used more often (since there are more small, single-export modules), but they are not generally preferred.
Use the right tool for the job. You already know the advantages you want.
Is there an idiomatic pattern for the revealing module pattern with ES6 module syntax?
Yes, Option #1. When you have multiple things to export, always use named exports.
You get both explicit aliasing and tree shaking from the picky syntax
import { foo, bar } from './export-file';
as well as namespaces
import * as baz from './export-file';