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-fvtt

v0.2.11

Published

A Vite plugin for module and system development for Foundry VTT

Readme

NPM Version GitHub License GitHub last commit GitHub repo size GitHub Actions Workflow Status

A Vite plugin to streamline and automate the development of Foundry VTT modules and systems.

It handles manifest resolution, asset copying, language file composition, and template handling with minimal setup, letting you focus on your code.

The plugin's core goal is to enable a robust HMR workflow via Vite's development server, freeing you from Foundry VTT's native HMR and build watch commands.

Changelog

🚀 Getting Started

Step 1. Setup a Foundry VTT Project

Create a standard Foundry VTT module or system. Place your module.json or system.json manifest in either your project root or your public/ directory.

Step 2. Add the Plugin to your Vite Config

Install the plugin with npm i -D vite-plugin-fvtt.

Add the plugin to your vite.config.js. The build.lib.entry field is required; most of the other settings are inferred by the plugin from your Foundry VTT manifest.

// vite.config.js
import { defineConfig } from 'vite'
import foundryVTT from 'vite-plugin-fvtt'

export default defineConfig({
  plugins: [foundryVTT()],
  build: {
    // ⚠️ Required: The entry point for your module/system.
    // This file should import your main CSS/SCSS/LESS file.
    lib: { entry: './src/main.js' },
    sourcemap: true,
  },
})

⚙️ Features

1. Configuration (Optional)

The plugin needs to know where your Foundry VTT instance is running to proxy and serve assets correctly. If you want to change anything from the defaults http://localhost:30000, create a .env.foundryvtt.local file in your project.

FOUNDRY_URL=localhost
FOUNDRY_PORT=30000

The Vite dev server will run on FOUNDRY_PORT + 1, where you will need to open your browser manually to.

2. Manifest & Asset Resolution

The plugin automatically detects your manifest file (module.json or system.json) in the project root or public/ folder.

This plugin shapes the output depending on your manifest; it tries to automatically discover the relevant files in the root, source, and public folders to build the output files. The public folder is defined by the Vite config file. The plugin determines the source directory based on your lib.entry path. For example, if your lib.entry is './mysource/package/main.js', the mysource/ directory is considered your source directory.

💡 Your entry file should always import your main stylesheet; the manifest dictates how everything is named and output.

3. ESModules, Scripts & Styles

esmodules and scripts declared in your manifest are automatically created from your lib.entry. Since Vite compiles the module, the plugin expects the esmodules or scripts entry in your manifest to only point to a single JavaScript file.

Stylesheets (CSS/SCSS/LESS) should be imported in your entry file; the plugin ensures they are outputted as the correct file.

4. Template Handling

Templates work in HMR properly on the development server; they are autodiscovered as discussed in 2. Manifest & Asset Resolution. The development server intercepts the websocket traffic and sends the local templates instead of Foundry VTT's, if present. e.g., a template request to /systems/mysystem/tpl/character-header.hbs might be rerouted to public/tpl/character-header.hbs. Folder structure inside your project is mirrored, apart from the system/module specific prefix.

5. Language File Merging

Supports both complete and partial translation workflows:

  • Complete files: Place a complete JSON file (e.g., public/lang/en.json) and the plugin will copy it as-is.
  • Partial files: Place multiple JSONs inside src/lang/en/ and the plugin merges them into one lang/en.json at build.

Merging follows your manifest’s declared language paths, searching in root or source directories.

6. Packs

Packs are tried to be auto-discovered in the source directory. If the paths match, they are automatically compiled.

Note: Packs are currently not watched for changes.

Example Project Structure

my-module/
├─ src/
│  ├─ main.js         # The primary module entry file (required by Vite).
│  ├─ style.css       # Your project's main stylesheet, imported by main.js.
│  └─ lang/en/        # Directory for partial, merged translation files.
│     ├─ spells.json
│     ├─ abilities.json
│     └─ general.json
├─ public/            # For static assets (templates, images)
│  ├─ module.json     # Your module's manifest file (or system.json).
│  └─ templates/      # HTML template files for your module.
├─ vite.config.js     # Your Vite configuration file.

📄 License

MIT