{"id":16904,"library":"sparkar-bundler","title":"Meta Spark Studio TypeScript Bundler","description":"sparkar-bundler is a command-line interface (CLI) tool designed to bundle TypeScript projects specifically for use within Meta Spark Studio. It leverages `esbuild` for high-performance bundling, enabling developers to write Spark AR scripts in TypeScript while benefiting from features like IntelliSense for both Meta Spark API definitions and external Node.js modules. This tool aims to streamline the development workflow by abstracting away complex bundling configurations. Currently at version 0.3.0, it is in active development with a focus on providing a seamless experience for integrating modern JavaScript/TypeScript practices into the Spark AR ecosystem. Its primary differentiator is the specialized handling of Meta Spark API type definitions, which is crucial for developer tooling in a proprietary environment. The release cadence is currently irregular as it's an early-stage project.","status":"active","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/pofulu/sparkar-bundler","tags":["javascript","typescript","sparkar","meta spark","bundler","esbuild","boilerplate","pofu"],"install":[{"cmd":"npm install sparkar-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add sparkar-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add sparkar-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundling engine; sparkar-bundler is based on esbuild.","package":"esbuild","optional":false}],"imports":[{"note":"This package is a global CLI tool, not a library to be imported via `import` or `require` statements in JavaScript/TypeScript code. Its functionality is accessed via the command line after global installation.","symbol":"sparkar-bundler","correct":"npm install -g sparkar-bundler"}],"quickstart":{"code":"npm install -g sparkar-bundler\n\n# Navigate into your Meta Spark Studio project directory\ncd ~/mySparkProject\n\n# Ensure you have an empty JavaScript file saved in Spark AR Studio\n# (e.g., scripts/script.js, ensure it's referenced in the project)\n\n# Run the bundler, it will guide you to select the target script\nsparkar-bundler\n\n# The bundled output (e.g., main.js) will be written to your selected script file.\n# You should see 'hello, world' (or your script's output) in Meta Spark Studio console.","lang":"typescript","description":"Demonstrates the global installation and basic command-line usage to bundle a TypeScript source file into a Meta Spark Studio project."},"warnings":[{"fix":"Always refer to the latest README or GitHub documentation for usage. Pin your CLI tool version or expect to update your workflow with new releases.","message":"As a pre-1.0 release (v0.3.0), the CLI arguments, configuration file format, and internal project structure assumptions are subject to frequent and breaking changes without prior notice. Backwards compatibility is not guaranteed between minor or even patch versions.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Stay informed about Meta Spark Studio updates and check the sparkar-bundler GitHub repository for compatibility notes or required updates to the bundler itself.","message":"The bundler relies on specific Meta Spark Studio project structures and behaviors. Future updates to Meta Spark Studio could introduce incompatibilities, potentially breaking the bundling process or the execution of bundled scripts.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Report issues on the GitHub repository if IntelliSense stops working after a Meta Spark Studio update. Consider contributing updated type definitions if you identify the changes.","message":"For IntelliSense to work correctly with Meta Spark API, the tool resolves specific type definitions. If these definitions change significantly in a Meta Spark Studio update, IntelliSense might become inaccurate or break until the bundler is updated.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure you install the package globally using `npm install -g sparkar-bundler`. Verify your PATH includes the global npm bin directory.","cause":"The package was not installed globally, or the global `node_modules` bin directory is not in your system's PATH.","error":"'sparkar-bundler' is not recognized as an internal or external command, operable program or batch file."},{"fix":"Open your Meta Spark Studio project, create a new JavaScript script (e.g., `script.js`), save the project, and ensure the script is referenced in the project's properties. Then rerun `sparkar-bundler`.","cause":"The bundler could not locate a JavaScript file within your Spark AR project's `scripts/` directory that is referenced in the `.arproj` file. Or you did not save the empty JavaScript file after creation in Meta Spark Studio.","error":"Error: Could not find a suitable script target in the project."},{"fix":"Install the missing module using `npm install module-name` and, if necessary, its type definitions with `npm install --save-dev @types/module-name`.","cause":"The TypeScript source code imports a module that is not installed in the project's `node_modules` or does not have corresponding type definitions.","error":"TypeScript compilation error: Cannot find module 'module-name' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null}