-
Notifications
You must be signed in to change notification settings - Fork 20
Build Setup
This library is provided as an ESNext module. You'll need a bundler to create a script file that can run in the browser.
To get started, pick a bundler of your choice:
This list is not exhaustive, so feel free to look around for another tool that best suits your needs.
The following example uses esbuild
for bundling.
Required Dependencies
"dependencies": {
"sparse-octree": "x.x.x",
"three": "x.x.x"
},
"devDependencies": {
"esbuild": "x.x.x"
}
Build Script
"scripts": {
"build": "esbuild src/app.js --bundle --minify --outfile=dist/app.js"
}
Use npm run build
to generate the code bundle. Include the file in an HTML file to run it in a browser.
For more information about configuration, features and plugins, see the official documentation of your chosen bundler.
Code transpilation prevents certain optimizations such as tree-shaking. Therefore, this library provides untranspiled code in the form of modules. If you want your app to run in older browsers, you can use Babel or a similar tool to transpile your final bundle into ES5 code.
Required Dependencies
"devDependencies": {
"@babel/core": "x.x.x",
"@babel/preset-env": "x.x.x"
}
Example Configuration
{
"compact": false,
"comments": false,
"presets": ["@babel/preset-env"]
}
For more information, please refer to the Babel documentation. You will also need a plugin for your bundler to integrate the transpilation process in your build setup.