This repo is now archived. The initial purpose of this repo was to demonstrate and expose the idea of using a bundler for Foundry VTT 3rd party development. I have since released significant 3rd party tooling based on Svelte / Vite providing a very modern approach to Foundry VTT package development. Check out those resources at the typhonjs-fvtt-lib organization.
This repo provides an example Foundry VTT starter project using Rollup to bundle / create a module with best practices integrated out of the gate. Rollup is a powerful / modern bundler that is worth considering for your Foundry development efforts.
Foundry VTT embraces modern Javascript / ES Modules (ESM) support, so why not choose a bundler / build tool that does so as well. Rollup is performant with excellent tree-shaking support for delivering reduced sized modules with the latest ESM features. For a full description of this demo repo / module please refer to the wiki. Below are the highlights.
- This repo / starter module is extremely well commented in all configuration files and source code.
- Cross platform environment variable support w/ cross-env and dotenv. Easily set custom deployment paths and options.
- Several Rollup plugin examples for loading HTML templates / JSON / copying files / replacing strings.
- PostCSS setup for Sass w/
autoprefixer /
postcss-preset-env which compiles all SCSS / Sass / CSS to
styles.css referenced by
module.json
- Terser enables optional minification / mangling with source maps support configured out of the box to work correctly w/ debug tooling. You can release an open source module w/ source maps and have confidence you can debug your module / system.
- ESLint configured w/ the rules TyphonJS FVTT modules use which can be swapped out for your preferred setup. More importantly @typhonjs-fvtt/eslint-config-foundry.js enables up to date coverage of all globals exported by foundry.js and works in tandem w/ the no-shadow rule preventing overriding any core Foundry VTT globals.
- A Github Action which automatically prepares and formats your module with the
release format that is required by Foundry VTT when tagging with
vX.X.X
(thanks Calego / ElfFriend for the starter). - Two examples of cleanly bundling NPM / Node modules separate of the main module code with a CJS example (ansi-colors) and an ESM module (unique-names-generator). Bundling Node modules is optional in your own module development.
- Install Foundry VTT
- Install the latest Node version
- Clone this repo
- Run
npm install
- Use an IDE to run the NPM scripts
- Change the deployment path in the
*.env
files as appropriate.
To install this module in Foundry VTT directly use the following link to the module.json
:
Feel free to reach out on Discord (MLeahy#4299) or post an issue in this repo. Drop by The League of Extraordinary Foundry developers and the main Foundry VTT Discord servers too!
For more tips and what this module actually does check out the wiki.