targetenv

1.0.0 • Public • Published

targetenv.js

This module is for doing things conditionally based on the environment you're targeting. It uses the build tool itself (browserify, webpack) instead of relying on examining the environment (for example, module.exports, etc).

Usage

var targetEnv = require('targetenv');
if (targetEnv.isBrowser) {
  // Do something.
}

Properties

target Either "main", "browser", "web", or "webpack", depending on which file was used as the main module.
isBrowser A boolean that indicates whether this code built for the browser.

How

The module's package.json tells your build tool (browserify, webpack) to use a different entry point (which can be examined).

Package Sidebar

Install

npm i targetenv

Weekly Downloads

23

Version

1.0.0

License

MIT

Last publish

Collaborators

  • matthewwithanm
  • lettertwo