tools/esbuild-plugin/README.md
@perspective-dev/esbuild-pluginApplications bundled with esbuild can make use of the
@perspective-dev/esbuild-plugin module. A full example can be found in the
repo under
examples/esbuild-example.
const esbuild = require("esbuild");
const { PerspectiveEsbuildPlugin } = require("@perspective-dev/esbuild-plugin");
esbuild.build({
entryPoints: ["src/index.js"],
plugins: [PerspectiveEsbuildPlugin()],
format: "esm",
bundle: true,
loader: {
".ttf": "file",
".wasm": "file",
},
});
When bundling via esbuild, you must also:
type="module" attribute in your app's <script> tag, as this build
mode is only supported via ES modules.esm versions Perspective, specifically
@perspective-dev/client/dist/esm/perspective.js and
@perspective-dev/viewer/dist/esm/perspective-viewer.js