Created
December 2, 2017 21:05
-
-
Save kamleshchandnani/ee73620136f8cae4cd1005b4ba3396b6 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
// File shakebake.js | |
const shake = () => console.log('shake'); | |
const bake = () => console.log('bake'); | |
//can be tree shaken as we export as es modules | |
export { shake, bake }; | |
// File index.js | |
import { shake } from './shakebake.js' | |
// only shake is included in the output | |
// File shakebake.js | |
const shake = () => console.log('shake'); | |
const bake = () => console.log('bake'); | |
//cannot be tree shaken as we have exported an object | |
export default { shake, bake }; | |
// File index.js | |
import { shake } from './shakebake.js' | |
// both shake and bake are included in the output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you have syntax error on line 20
https://stackoverflow.com/questions/43814830/destructuring-a-default-export-object