Open ADSKLowenthal opened 8 years ago
Part of this request (feature flags, or toggling code by env) could be hacked around now by setting globals with webpack and DefinePlugin, but it means wrapping every file in the package in an if statement, and only works on public/frontend files. Also will still process import
statements at the top of files (afaik you are not allowed to do conditional imports by design of the import API), so really only works if using require
/require.ensure
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}
})
if (process.env.NODE_ENV === 'production) {
angular code here
}
It looks like this may be already present in the source?
function findModules(meanioinstance, defer, app) {
var disabled = _.toArray(meanioinstance.getConfig().disabledModules);
Q.all([
search(_modules, disabled, 'packages'),
search(_modules, disabled, 'packages/core'),
search(_modules, disabled, 'packages/custom'),
search(_modules, disabled, 'packages/contrib'),
search(_modules, disabled, 'node_modules')
]).done(findModulesDone.bind(null, meanioinstance, app, defer), findModulesError.bind(null, defer));
}
https://github.com/linnovate/meanio/blob/master/lib/core_modules/module/index.js#L76
Probably using the different configs per environment, we should allow some modules to not be loaded by MeanIO. This could be helpful for special logging packages, or debugging packages.