Skip to content

Instantly share code, notes, and snippets.

@pushkar100
Last active October 18, 2020 08:47
Show Gist options
  • Save pushkar100/22566bf98aacf4d498ca3e969ee59157 to your computer and use it in GitHub Desktop.
Save pushkar100/22566bf98aacf4d498ca3e969ee59157 to your computer and use it in GitHub Desktop.
webpackExports single export
/* ./utilities.js */
export const add = (a, b) => a + b
export const subtract = (a, b) => a - b
export const multiply = (a, b) => a * b
export const divide = (a, b) => a / b
const power = (a, b) => Math.pow(a, b)
export default power
/* ./main.js */
import(/* webpackExports: "add" */ './utilities.js')
.then(module => {
console.log(module.add)
// Only module.add is available and nothing else!
// Chunk created too is smaller
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment