JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 49978341
  • Score
    100M100P100Q256226F
  • License MIT

Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST

Package Exports

  • loose-envify
  • loose-envify/custom
  • loose-envify/replace

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (loose-envify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

loose-envify

Build Status

Fast (and loose) selective process.env replacer using js-tokens instead of an AST. Works just like envify but much faster.

Gotchas

  • Doesn't handle broken syntax.
  • Doesn't look inside embedded expressions in template strings.
    • this won't work:
    console.log(`the current env is ${process.env.NODE_ENV}`);
  • Doesn't replace oddly-spaced or oddly-commented expressions.
    • this won't work:
    console.log(process./*won't*/env./*work*/NODE_ENV);

Usage/Options

loose-envify has the exact same interface as envify, including the CLI.

Benchmark

envify:

  $ for i in {1..5}; do node bench/bench.js 'envify'; done
  708ms
  727ms
  791ms
  719ms
  720ms

loose-envify:

  $ for i in {1..5}; do node bench/bench.js '../'; done
  51ms
  52ms
  52ms
  52ms
  52ms