Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including environment-brunch with all npm packages installed. Try it out:

require("brunch/package.json"); // brunch is a peer dependency. var environmentBrunch = require("environment-brunch")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

environment-brunch v1.0.0

Replaces a defined token with the current brunch environment.


Replaces a defined token with the current environment in your js/ts files in Brunch.

The environment defaults to development if not set.

It will replace the string BRUNCH_ENVIRONMENT by default, but this can be overridden by setting the token config.

module.exports.config = {
  plugins: {
    environment: {
      token: /\$!ENV!\$/g

You can also provide a string value and that will work as well. If you provide a regular expression, make sure that you set the g flag to replace all occurences, not just the first one.

The replacement is not wrapped in anything so make sure you account for that in your files.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free