Make Release Version More Obvious in Build Output

Is your feature request related to a problem? Please describe.

Currently in the build output (e.g. three.js), there’s no way to tell what the version of three.js is.

EDIT: Currently in the build output (e.g. three.js), it’s not immediately obvious what the release version or “revision” is.

Describe the solution you’d like

I would like to see some version information included at the top of the source file.

// version: 0.125.2
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

For example, we could reference version in package.json at the time of the build.

An example proposal would be in utils/build/rollup.config.js:

import pkg from "../../package.json";


function header() {

	return {

		renderChunk( code ) {

			return (
                             '//\n' +
                             `// version: ${pkg.version}\n` +




Describe alternatives you’ve considered

We could potentially use information from git like the latest tag or commit hash.

There may be a Rollup plugin we can include for this purpose:

The point is to include some indication of the version in the build output .js file.

Any thoughts on this?

1 possible answer(s) on “Make Release Version More Obvious in Build Output

  1. Changing the position of the mentioned line in the build file is problematic since you normally have no control how the build tool merges your code together. And since the build config is already complex, I do not vote to change something to accommodate this issue.

    You have 125 results when you are searching for version in build/three.js (in contrast to 6 when searching for revision). So I’m not sure if adding a comment will provide much benefit.

    Have you considered to install three.js developer tools in your browser? When you enable the tool in the browser’s dev tools, it shows you the used three.js version in the console.


    That is super handy! I had no idea this existed.

    Thank you again for you helpfulness!

    How about add such as export const VERSION = REVISION; as an alias at constants.js line 2?

    @gonnavis This seems reasonable, but I’m not very concerned with it. I do appreciate your input here as well!

    For context, I’m completely new to Three.js, but I wouldn’t look for the version to be re-defined by a source code variable.
    I searched for “r125” originally in the file, and failed to search for “125”.

    I’m more than satisfied with the responses and help from @Mugen87. 🙂

    Feel free to re-open if anyone wants more discussion.