npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-jscad

v0.0.1

Published

Vite plugin for previewing and compiling JSCAD (and TSCAD) models

Readme

vite-plugin-jscad

vite-plugin-jscad is a model preview development server and bundler for JSCAD models. Models written in TypeScript (TSCAD) or JavaScript using ESM (import syntax) are supported.

  • Preview server: The preview server provides a live view of your model. It's just a website running locally, so you can open it in any browser. It's fully interactive. As you save changes to your model, the preview will be updated in realtime while maintaining your camera position or zoom level. The feedback cycle is lightning fast.
  • Bundler: The bundler compiles your model into a JavaScript file that can be read by the jscad CLI for transformation into an output format like STL. This is particularly useful if you want to write your models in TypeScript instead of plain JavaScript.

Setup

Setup is straightforward:

  1. (Optional) Set up TypeScript by creating a tsconfig.json file by running npx tsc --init

  2. Install Vite in your project by running npm install --save-dev vite

  3. Install the plugin with npm install --save-dev vite-plugin-jscad

  4. Configure the plugin. Create a vite.config.ts file with the following contents:

    import type {UserConfig} from "vite";
    import {jscadPlugin} from "../plugin/vite-plugin-jscad";
     
    export default {
      plugins: [jscadPlugin()]
    } satisfies UserConfig

    If using plain JS without TypeScript, create vite.config.js instead:

    import {jscadPlugin} from "../plugin/vite-plugin-jscad";
     
    export default {
      plugins: [jscadPlugin()]
    }

Configuration

The only configuration option is the path to your model file. This can be inferred automatically:

  • First, it will look for build.lib.entry in your Vite config
  • Then it will look for main in your package.json
  • Finally, it will look for index.js or index.ts in your project root

If none of these apply for you, you'll need to pass the module file path explicitly to jscadPlugin:

jscadPlugin({moduleFile: "path/to/file.js"})

Usage

Preview server

To run the preview server, run:

npx vite

Then open the given localhost URL in your browser. You can customize which port it runs on by setting server.port in your config file.

To see changes, simply edit your model file and save it.

If you are using VSCode, the built-in browser can provide a convenient preview without installing any exensions. Simply press Cmd/Ctrl+Shift+P to open the command palette and type "Open Port In Browser", then enter the preview port (5173 by default).

Bundling and compiling models

To bundle your model, run:

npx vite build

Then you can compile your model using the JSCAD CLI:

# Assuming your file is named index.ts
npx jscad dist/index.js -o index.stl

For convenience, you may want to combine these into a single script in your package.json file:

{
  "scripts": {
    "start": "vite",
    "build": "vite build && jscad dist/index.js -o index.stl"
  }
}