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

Optional Features #117

Open
deepakduggirala opened this issue Dec 13, 2023 · 2 comments
Open

Optional Features #117

deepakduggirala opened this issue Dec 13, 2023 · 2 comments
Assignees
Labels

Comments

@deepakduggirala
Copy link
Contributor

deepakduggirala commented Dec 13, 2023

"Genome Browser" - This field is only relevant in CMG / Xenium applications.

Options:
After merging bioloop commit to remove genome_browser into Xenium, apply a reverse commit to bring back the genome_browser feature in Xenium.

@deepakduggirala
Copy link
Contributor Author

Also remove "data files" or "genome files"?

@deepakduggirala deepakduggirala changed the title Remove references of genome_browser flag from bioloop Optional Features Dec 22, 2023
@deepakduggirala
Copy link
Contributor Author

Vue Dynamic import of optional features

  • if a feature is not required in some bioloop instances, make it into a component and dynamically import it. The code for that component will not be included in the build?

To enable or disable features in a Vue 3 app built with Vite based on configuration, you can use conditional rendering and dynamic imports. Here's a basic approach:

  1. Create a Configuration File:
    Start by creating a configuration file (e.g., config.js) where you can define feature flags or settings.
// config.js
   export default {
     enableFeatureA: true,
     enableFeatureB: false,
   };
  1. Use Dynamic Imports:
    In your Vue components, use dynamic imports based on the configuration settings.
// MyComponent.vue
import config from '@/config';

export default {
 async mounted() {
   if (config.enableFeatureA) {
     const { featureA } = await import('./FeatureA');
     // Use featureA here
   }

   if (config.enableFeatureB) {
     const { featureB } = await import('./FeatureB');
     // Use featureB here
   }
 },
};
  1. Webpack Chunking:
    Vite and Webpack automatically handle code splitting when using dynamic imports. Features that are not enabled will not be included in the main bundle.

  2. Build the App:
    When you build your Vite app (vite build), it will generate separate chunks for each dynamically imported feature. Disabled features will not be included in the main bundle, reducing the final bundle size.

Remember to manage your dependencies and imports carefully to avoid unnecessary code in the final build.

This approach ensures that only the necessary code for enabled features is included in the final build, helping to keep your app lightweight and efficient.

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

Successfully merging a pull request may close this issue.

1 participant