A custom plugin to build OpenFL (and Feathers UI) projects with Vite.
Create a new directory for your project.
Create the necessary files for an OpenFL project, including project.xml inside the project's root directory and your .hx source files. Then, follow the remaining steps to setup Vite and vite-plugin-openfl.
In a terminal, run the following command in the root of your project to create a package.json file:
npm init -y
Then, run the following command to install the required dependencies:
npm install --save-dev vite vite-plugin-openfl
Open the package.json file, and modify the scripts
section:
"scripts": {
"start": "vite",
"build": "vite build"
}
Create a vite.config.js file in the root of your project:
import { defineConfig } from "vite";
import openflPlugin from "vite-plugin-openfl";
export default defineConfig({
plugins: [openflPlugin()],
});
To start a local development server, run the following command. Then, open http://localhost:5173/ in a web browser.
npm start
To build a production JavaScript bundle, run the following command:
npm run build