budo
budo copied to clipboard
Dynamic require in conjunction with envify
Hi! I form the config for a large project kit in the following way in conjunction with envify
module.exports = xtend(
require('../config/__defaults/common'),
require('../config/__defaults/' + process.env.stage),
require('../config/' + process.env.project + '/common'),
require('../config/' + process.env.project + '/' + process.env.stage)
)
When i bundle project with browserify
all works perfectly!
NODE_ENV=production browserify src/index.js \
-t [envify --project ${1:-'main'} --stage ${2:-'dev'}] \
-g uglifyify \
> bundle.min.js
But when i try to use this browserify
configuration with budo
budo src/index.js:bundle.js -P -- \
-t [envify --project ${1:-'main'} --stage ${2:-'dev'}]
budo
returns me
Cannot find module '../config/__defaults/dev'
but i have this file.
So, maybe you know what i'm doing wrong?
Thanks, it seems like a bug somewhere with arg/subarg parsing.
Have you tried using the API and specifying browserify: { transform: ... } }
manually? It would be interesting to see if that works fine.
Yep, i tried hardcoded needed parameters in package.json
but result the same.
"browserify": {
"transform": [
"aliasify",
["envify", {
"project": "main",
"stage": "dev"
}]
]
}
Interesting that after error debugger shows me this precompiled code
module.exports = xtend(
require('../config/__defaults/common'),
require('../config/__defaults/' + "dev"),
require('../config/' + "main" + '/common'),
require('../config/' + "main" + '/' + "dev")
)
Seems like problem in 'dynamic require'...