0

Trying to run multiple transforms with browserify.

I have the following files in a directory

  • dev.json
  • stage.json
  • prod.json
  • index.js

The json files are environment specific config files.

index.js :

var mode = process.env.APP_ENV; module.exports = require('./' + mode + '.json');

I am using the envify transform to pick between dev/prod/stage and configurify to evaluate dynamic expressions.

If I just run the envify it works fine but when I use envify followed by configurify, I get an error saying "./undefined.json" not found.

enter image description here

Any help is appreciated.

user843453
  • 241
  • 2
  • 6
  • At some point the `mode` variable is not being set, or you are trying to access it out with its scope. – Daniel Waghorn Jul 26 '16 at 22:22
  • @DanielWaghorn my understanding is that the transforms happen in order so mode should be equal to "dev" as per the first command. Correct me if my understanding is wrong. – user843453 Jul 26 '16 at 22:40

1 Answers1

0

Took some to understand how browserify transforms work using streams. Apparently the configuriy transform was not using the stream and instead reading the file form disk. Opened an issue.

user843453
  • 241
  • 2
  • 6