Skip to content

Remove Development code during build #42

Description

@taksh108

Sometimes there's little piece of code that is helpful for local development, but not needed on the production environment. This feature was initially discussed on Shopify Devs discord, where others agreed it'd be a useful addition.
Examples of where I'd use it would be -

// Move Syncify label if it interrupts with workflow
#syncify-hot-label-status {
  z-index: -1 !important;
}
// cleanup States in JS
if (import.meta.hot) {
  import.meta.hot.accept((newModule) => {
    // Perform clean up of old state if needed
    BundleStateManager.cleanup?.();

    // Update the module
    Object.assign(window, newModule);
  });
}

A liquid comment could work, which ignores a few lines of code. This can be used to link dev-only assets and output test data.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions