Last active
September 5, 2023 19:18
-
-
Save jbaiter/e830fb9fd5b2de5bc9d8db341c91bf94 to your computer and use it in GitHub Desktop.
Minimal sample to reproduce esbuild bug with disabled dependencies
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
import nodeFetch from 'node-fetch'; | |
let fetchImpl; | |
if (typeof fetch !== 'undefined') { | |
fetchImpl = fetch; | |
console.log('Using browser fetch'); | |
} else { | |
console.log('Using node-fetch'); | |
fetchImpl = nodeFetch; | |
} |
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
{ | |
"name": "esbuild-disabled-dep", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"run-vite": "vite", | |
"build": "esbuild index.js --bundle --outfile=./out.js", | |
"build-rollup": "vite build" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"node-fetch": "^3.3.2" | |
}, | |
"devDependencies": { | |
"esbuild": "^0.19.2", | |
"vite": "^4.4.9" | |
}, | |
"browser": { | |
"node-fetch": false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment