Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to mark packages inactive for specific environments #121

Open
ADSKLowenthal opened this issue Sep 23, 2016 · 2 comments
Open

Comments

@ADSKLowenthal
Copy link
Contributor

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.

@timelf123
Copy link
Contributor

timelf123 commented Oct 25, 2016

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
}

@timelf123
Copy link
Contributor

timelf123 commented Jan 27, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants