Skip to content

Instantly share code, notes, and snippets.

@WebReflection
Last active February 20, 2022 10:31
Show Gist options
  • Save WebReflection/ef9c845ef222a53018c8ef06f4124809 to your computer and use it in GitHub Desktop.
Save WebReflection/ef9c845ef222a53018c8ef06f4124809 to your computer and use it in GitHub Desktop.
// keeping the same pattern
export default await new Promise(async $export => {
// export the module
$export({my: 'module'});
});
// dropping the Promise all together
export default await (async () => {
// await async dependencies
// export the module
return {my: 'module'};
})();
// both static and dynamic importers will work
import module from './module.js';
// or
import('./module.js').then(m => {
const module = m.default;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment