With a combination of exports, you can import a default function and all other functions as an object.
Let's see how it's done. Let's say we have the following exports:
export function func1() {
return '1'
}
export function func2() {
return '2'
}
export default function() {
return 'text';
};
We import a default function and all
other functions named mod
:
import test, * as mod from './test.js';
Let's check the default function:
let res = test();
console.log(res);
And other functions:
let res1 = mod.func1();
let res2 = mod.func2();
console.log(res1, res2);
Create a module that exports one default function and a few more functions as an object with functions.