Last active
March 16, 2023 20:20
-
-
Save frehner/bacbeb07b309b35d83d58f3cb5130da1 to your computer and use it in GitHub Desktop.
Dot notation with treeshaking
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
// we change our library to have multiple entry points. Note that this has a large effect on our package.json, bundler settings, etc. | |
// in our library. file: "src/CartLine" | |
export {CartLine, CartLineQuantityAdjustButton} from 'index.js' | |
// in a dev's project | |
import * as CartLine from '@shopify/hydrogen/CartLine' |
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
// the importer/dev writes a façade file that does it on their side of things: (both files in the dev’s project) | |
// file: "src/CartLine" | |
export {CartLine, CartLineQuantityAdjustButton} from '@shopify/hydrogen' | |
// file "src/routes/SomeRoute" | |
import * as CartLine from '~/CartLine' |
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
// we just don't care about treeshaking at all :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment