Skip to content

Instantly share code, notes, and snippets.

Last active March 20, 2022 20:08
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
The simplest possible use of esbuild to import a package and run a function in the browser
# run this first, then run `make` to build your bundle at `out.js`
npm install esbuild simplex-noise
import SimplexNoise from 'simplex-noise'
s = new SimplexNoise(Math.random);
console.log(s.noise2D(1.23, 2.34));
./node_modules/.bin/esbuild index.js --bundle --outfile=out.js
<script src="out.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment