build.js 742 B

123456789101112131415161718192021222324252627
  1. // Do this as the first thing so that any code reading it knows the right env.
  2. process.env.BABEL_ENV = 'production';
  3. process.env.NODE_ENV = 'production';
  4. process.env.ASSET_PATH = '/';
  5. var webpack = require('webpack'),
  6. path = require('path'),
  7. fs = require('fs'),
  8. config = require('./webpack.config'),
  9. ZipPlugin = require('zip-webpack-plugin');
  10. delete config.chromeExtensionBoilerplate;
  11. config.mode = 'production';
  12. var packageInfo = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
  13. config.plugins = (config.plugins || []).concat(
  14. new ZipPlugin({
  15. filename: `${packageInfo.name}-${packageInfo.version}.zip`,
  16. path: path.join(__dirname, '../', 'zip'),
  17. })
  18. );
  19. webpack(config, function (err) {
  20. if (err) throw err;
  21. });