What does `type = "javascript"` in `wrangler.toml` actually do?

I’m guessing that the worker gets built using webpack when type = "webpack" , and therefore building the worker does not use webpack when type = "javascript" … but then what does it use?

Does it use npm build ? But the starter package.json doesn’t have a build script.

Does it just use the index.js you provide, and not run a build step at all? But then why does the starter have a package.json at all?

I am confused and cannot find this described in the docs.

The documentation for wrangler build says:

Build your project. This command looks at your wrangler.toml file and runs the build steps associated with the “type” declared in your wrangler.toml.

but it does not explain what the build steps associated with each build type are.

The documentation for the type key says:

Specifies how wrangler build will build your project. There are currently three options (webpack, javascript, and rust).

but again does not explain what those build steps actually are.

Any ideas?

The type = "javascript" doesn’t run any build step. The package.json file is necessary to find the worker’s entrypoint (using the main key). The file will be uploaded as is.

I agree that we should document it properly.