Created
October 29, 2020 15:04
-
-
Save manzt/e38d758c868d6a1a1237f433701f63f1 to your computer and use it in GitHub Desktop.
esbuild code-splitting
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
import { log } from './shared'; | |
export default (a: number, b: number): number => { | |
log(); | |
return a + b; | |
} |
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
export { default as add } from './add'; | |
export { default as subtract } from './subtract'; |
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
{ | |
"name": "esbuild-spltting-issue", | |
"version": "1.0.0", | |
"main": "dist/index.js", | |
"type": "module", | |
"exports": { | |
".": { | |
"import": "./dist/index.js" | |
}, | |
"./add": { | |
"import": "./dist/add.js" | |
}, | |
"./subtract": { | |
"import": "./dist/subtract.js" | |
} | |
}, | |
"scripts": { | |
"build": "esbuild --bundle --splitting --format=esm --outdir=dist index.ts add.ts subtract.ts" | |
}, | |
"dependencies": { | |
"esbuild": "^0.8.0" | |
} | |
} |
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
import { log } from './shared'; | |
export default (a: number, b: number): number => { | |
log(); | |
return a - b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment