title: webpack - DefinePlugin method
body: <p>In the defintions for a webpack plugin, I'm trying to supply an override function that my module will pickup if the method exists.</p>
  
  <pre><code>export const listFetchAPI = () =&gt; {
    return ( LIST_FETCH_API ? LIST_FETCH_API : '/list/');
  };
  export const listFetchTX = (data) =&gt; {
    return ( LIST_FETCH_TX === 'function' ? LIST_FETCH_TX(data) : data );
  };
  </code></pre>
  
  <p>In my webpack config, based on the environment or implementation of the project, I may or may not want to supply overrides for these functions.</p>
  
  <pre><code>webpackConfig.plugins.push(
    new webpack.DefinePlugin({
      LIST_FETCH_API: JSON.stringify('https://testapi.com/listFetch/')
      LIST_FETCH_TX(data) { return { ...data, test: 'HELLO!' }; }
    })
  );  
  </code></pre>
  
  <p>I've tried with both ES5 and ES6 notation. When I build, I get an error <code>SyntaxError: Unexpected identifier</code></p>
  
  <p>I don't see in the docs where you can pass a method through the DefinePlugin. <a href="https://webpack.js.org/plugins/define-plugin/" rel="nofollow noreferrer">https://webpack.js.org/plugins/define-plugin/</a></p>
  
  <p>Google search comes up nill.  My next step would be to pass a string value and then use <code>react-json-schema</code> to pick up the component.  That seems too involved, so I'm hoping there's a way to define methods in <code>DefinePlugin</code>.</p>
  
  <p><strong>EDIT</strong>
  For clarification, what I'm doing is build a generic redux module which can registered to a private npm registry. When invoked, this module can be supplied overrides for the API urls and response translators. This prevents me from branching code or creating modules that are 99% similar every time I do an install for a different vendor.</p>
  
  <p>If supplying functions through an environment variable is not appropriate, what would be an alternative method to allow for such overrides?  I'm not sure the config object plays out when things are being dispatched through the store. The other option I'm playing around with is overriding entire files in a module. I'm familiar methods in Ruby using import_path, but in research, I haven't seen any equivalent JS/npm methods.</p>