esbuild-plugin-purescript is a package which allows esbuild users to directly import .purs files in their javascript.
import { main } from "./Main.purs";
console.log("Loaded purescript code 🚀");
main();
Another useful feature is the ability to dinamically pick the output directory inside your build.js (useful in combination with zephyr):
const isProd = process.env.NODE_ENV === "production";
esbuild
  .build({
    entryPoints: ["src/index.js"],
    bundle: true,
    outdir: "dist",
    plugins: [
      PurescriptPlugin({
        output: isProd ? path.resolve(__dirname, "dce-output") : undefined, // defaults to "output"
      }),
    ],
  })
  .catch((_e) => process.exit(1));
Note: This plugin is not going to run
spago buildor similar commands for you. This plugin only points esbuild to your existingoutputdirectory