How to abstract environmental JS class implementations

I have an abstraction of an adapter. Through an environmeht variable I control which implementation is used. I am not satisfied with this approach, since the mock variant is imported in production code. I would like to have something like in Symfony, where implementation of abstractions can be defined in environmental service configurations.

Currently I have following abstraction:

import HttpERPAdapter from "./HttpERPAdapter";
import MockERPAdapter from "./MockERPAdapter"; // todo, find an abstraction solution to not deploy this in production
import httpClient from "common/HttpClient";

const create = () => {
    if (process.env.REACT_APP_ERP_API_URL === 'mock') {
        return new MockERPAdapter();
    }
    return new HttpERPAdapter(httpClient);
}

const erpAdapter = create();
export default erpAdapter;
  • The mock variant: Mainly used when developing GUI when I have not to rely on real api data, for faster development.
  • The productive variant: For for developing with real api data, and for the productive build

I am sure that a compilation in a production build will contain the mock class. This is what I want to prevent.

Any ideas on how to separate the mock implementation from the productive code, so that it will not be dumped in the productive build?