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

Feature flags for different entry points #73

Open
iwano opened this issue May 6, 2016 · 0 comments
Open

Feature flags for different entry points #73

iwano opened this issue May 6, 2016 · 0 comments

Comments

@iwano
Copy link

iwano commented May 6, 2016

Is there a way to set a feature flag with the current entry point name so we could reuse components but at the same time change them slightly (deeply nested imports for example). Something like:

module.exports = {
  entry: {
    main: './src/main.js',
    admin: './src/admin.js'
  },
  output: {
    filename: "[name].bundle.js"       
  },
};

var definePlugin = new webpack.DefinePlugin({
  __APP_MODE__: "[name]"
});

In order to do something like:

import Menu from './components/menu'

/components/menu.js

if (__APP_MODE__) {
  module.exports = require('./admin/menu');
} else {
  module.exports = require('./main/menu');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant