Last active
October 18, 2020 09:22
-
-
Save pushkar100/fd95bd3547a34ecf1ceba63a387b44a4 to your computer and use it in GitHub Desktop.
Chunk exports without partial split
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
// (A) What happens when you try to load dynamic chunks: | |
/* ./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('./utilities.js') | |
.then(module => { | |
console.log(module.add) | |
// We require ONLY module.add | |
// BUT... | |
// The module contains every export! | |
// i.e It also contains module.subtract, module.multiply, | |
// module.divide, & module.default | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment