title: Webpack plugin: How to dynamically add a loader to a module?
body: <p>I'm writing a Webpack plugin. During module resolution, this plugin should dynamically add a specific loader for <em>some modules</em>, but not for all.</p>
  
  <p>My idea right now is to tap into <code>normal-module-factory</code>'s <code>after-resolve</code> event. There, I could modify the array <code>data.loaders</code>. Some debugging showed me that this array contains objects of the form <code>{ loader: string, options: object | undefined }</code>.</p>
  
  <p>I couldn't find any documentation on modifying per-module loaders on the fly. So I'm wondering:</p>
  
  <ul>
  <li>Is this the right approach?</li>
  <li>Some (but not all) existing <code>loaders</code> entries contain an additional property <code>ident</code>, looking like this: <code>'ref--0-0'</code>. When should I set this property, and using what value?</li>
  </ul>