Last active
November 28, 2019 17:53
-
-
Save shisama/5571401e79fb043f60b58afb4a0875a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default () => { | |
| console.log("default export") | |
| } | |
| export function printArg(arg) { | |
| console.log(arg) | |
| } | |
| export function throwError() { | |
| throw Error("error!"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default () => { | |
| console.log("default export2") | |
| } | |
| export function printArg(arg) { | |
| console.log(arg, '2') | |
| } | |
| export function throwError() { | |
| throw Error("error2!"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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