title: Webpack generate file on build
body: <p>In my project at work we use Vue with VueI18n for localization. We have one ref.js file which looks like this:  </p>
  
  <pre class="lang-js prettyprint-override"><code>export default {
    project: {
      lang: {
        test: {
          value: 'The test was a success',
          context: 'This string is a test string',
        },
      },
    },
  },
  </code></pre>
  
  <p>This ref file is needed for the translation team and is our 'single source of truth'. 
  Now on build an en.js file is supposed to be generated. The en.js file would look like this:  </p>
  
  <pre class="lang-js prettyprint-override"><code>export default {
    project: {
      lang: {
        test: 'The test was a success',
      },
    },
  },
  </code></pre>
  
  <p>Basically replacing the object under the test key with only its value.<br>
  Right now we have a file watcher running in the background which generates the en.js file every time the ref.js file changes. What I would like is to integrate this en.js generation into the webpack build process.<br>
  Requirements are:</p>
  
  <ul>
  <li>Generates en.js file on initial build</li>
  <li>Watches the ref.js file and generates en.js when ref.js file changes</li>
  </ul>
  
  <p>I tried writing a webpack plugin but didn't get very far. I think the steps would be as follows:</p>
  
  <ul>
  <li>tap into beforeRun hook (generate file initilially)</li>
  <li>tap into watchRun?/beforeCompile? -> check changed files and if ref.js is among them -> generate file</li>
  </ul>
  
  <p>What I dont understand is where/how do I see which files have changed ?</p>