Skip to content

Instantly share code, notes, and snippets.

@kamleshchandnani
Created December 2, 2017 21:05
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 kamleshchandnani/ee73620136f8cae4cd1005b4ba3396b6 to your computer and use it in GitHub Desktop.
Save kamleshchandnani/ee73620136f8cae4cd1005b4ba3396b6 to your computer and use it in GitHub Desktop.
// 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
Copy link

ghost commented Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment