Skip to content

Instantly share code, notes, and snippets.

@llimllib
Last active Mar 20, 2022
Embed
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));
build:
./node_modules/.bin/esbuild index.js --bundle --outfile=out.js
<html>
<head>
<script src="out.js"></script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment