Webpack Configuration

I’m using Terraform to configure my Cloudflare site.

I tried using Wrangler to manage my workers, but the fact that it requires exactly one npm package per worker makes it difficult to manage multiple workers in a single Terraform configuration.

A natural solution is Webpack. Does anyone have recommended Webpack settings for Cloudflare workers?

My most used config:

const path = require("path");

const config = {
  target: "webworker",
  mode: "production",
  devtool: 'none',
  entry: "./src/index.js",
  output: {
    path: path.resolve(__dirname, "build"),
    filename: "worker.js"

module.exports = config;
1 Like