title: How do I build a JSON file with webpack?
body: <p>I'd like to assemble a <code>manifest.json</code> file, as used by Chrome extensions, in a "smarter," programmatic sort of way. I'm using npm for my dependency resolution, and its <code>package.json</code> includes some shared fields with the <code>manifest.json</code> file, including "name," "description," and "version."</p>
  
  <p>Is there a way to define something like a partial <code>manifest.json</code> file which includes all the Chrome-specific stuff, but fill in shared values where appropriate? I've found that this is pretty straightforward in Gulp:</p>
  
  <pre><code>var gulp = require('gulp');
  var fs = require('fs');
  var jeditor = require('gulp-json-editor');
  
  gulp.task('manifest', function() {
      var pkg = JSON.parse(fs.readFileSync('./package.json'));
      gulp.src('./manifest.json')
        .pipe(jeditor({
          'name': pkg.name,
          'description': pkg.description,
          'version': pkg.version,
          'author': pkg.author,
          'homepage_url': pkg.homepage,
        }))
        .pipe(gulp.dest("./dist"));
  });
  </code></pre>
  
  <p>Even if there's some npm package out there designed for this purpose, can someone explain to me how something like this might be done generally? I know Webpack 2 has a built-in json loader, but I'm not clear how it would be used in a case like this.</p>