Module plugins/vite

Functions

builtAssetsDirectory

"assets" -> the directory name inside the output directory to put e.g. glb files into

editorConnection
getOutputDirectory
isRemoteEnabled

Whether remote debugging is enabled. Toggled by the remote user setting or the NEEDLE_REMOTE env var (the env var wins so you can flip it without editing the config: NEEDLE_REMOTE=1 npm run dev, or NEEDLE_REMOTE=false to force off).

loadConfig

Load the codegen meta file.

needleAI

Needle Engine AI skill installer.

needleApp
needleAsap

Injects needle asap script into the index.html for when the main needle engine bundle is still being downloaded.

needleBuild
needleBuildInfo

Create a buildinfo file in the build directory.

needleBuildPipeline

Runs the needle build pipeline as part of the vite build process.

needleCopyFiles

Copy files on build from assets to dist.

needleCustomElementData

Ensure the repo workspace or .vscode settings include Needle Engine custom HTML data if they exist. Copies custom-elements.json to the project and merges with existing user content.

  • Copies/merges custom-elements.json to project root
  • Adds ./custom-elements.json to .code-workspace settings.html.customData
  • Adds ./custom-elements.json to .vscode/settings.json html.customData
needleDefines
needleDependencies
needleDependencyWatcher
needleDrop

Experimental, allow dropping files from Unity into the running scene.

needleDtsGenerator
needleFacebookInstantGames
needleImportsLogger
needleLicense

This plugin is used to apply the license to the needle engine.

needleLocalFilesSceneAnalysis
needleLogger

write logs to local file

needleMakeFilesLocal
needleMeta
needlePeerjs
needlePlugins

Needle Engine plugins for Vite

Plugins include hot reload support, meta tags, defines, build pipeline, PWA, and more.

How to add PWA support to your vite project:

  1. Install the vite pwa plugin: npm install vite-plugin-pwa --save-dev
  2. Add the following to your vite.config.js: You first pass the PWAOptions to the needlePlugins function, then you pass the same PWAOptions to the VitePWA plugin. You can use also add a .webmanifest file to your web project and edit the PWA manifest settings there.
needlePoster
needlePWA

Provides reasonable defaults for a PWA manifest and workbox settings.

needleReload
needleRemote

Remote debugging plugin.

needleServer

Can open the network server in the browser.

needleTransformCodegen

Modify the glb load path in codegen files. This is necessary if the assets directory is not the default (changed by the user in needle.config.json).

needleTreeshake

Scans local GLB/glTF files to determine which engine components are actually used, then rewrites the engine's codegen/register_types.ts so that unused components are registered lazily via TypeStore.addLazy() instead of eagerly imported.

needleViteAlias
tryLoadProjectConfig

get the needle.config.json

useGzip

Returns true when the Needle project is configured to serve gzip-compressed assets. Reads the gzip field from the config object.