Skip to content

Instantly share code, notes, and snippets.

@shisama
Last active November 28, 2019 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shisama/5571401e79fb043f60b58afb4a0875a6 to your computer and use it in GitHub Desktop.
Save shisama/5571401e79fb043f60b58afb4a0875a6 to your computer and use it in GitHub Desktop.
export default () => {
console.log("default export")
}
export function printArg(arg) {
console.log(arg)
}
export function throwError() {
throw Error("error!");
}
export default () => {
console.log("default export2")
}
export function printArg(arg) {
console.log(arg, '2')
}
export function throwError() {
throw Error("error2!");
}
let importModule;
if (someBool) {
importModule = import('./export.js');
} else {
importModule = import('./export2.js');
}
importModule.then(module => {
module.default();
module.printArg('Hello');
module.throwError();
}).catch(e => {
console.error(e)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment