Last active
October 18, 2020 08:47
-
-
Save pushkar100/22566bf98aacf4d498ca3e969ee59157 to your computer and use it in GitHub Desktop.
webpackExports single export
This file contains 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
/* ./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