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 = ;if targetEnvisBrowser // 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).