Commit a9a603e7 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Revert webpack.config.js

parent fa04b50b
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var execSync = require('child_process').execSync;
var webpack = require('webpack'); var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin'); var StatsPlugin = require('stats-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin'); var CompressionPlugin = require('compression-webpack-plugin');
...@@ -198,33 +197,7 @@ var config = { ...@@ -198,33 +197,7 @@ var config = {
} }
} }
function getHeadCommitSHA() {
// Simple SHA validation.
// Match 5-40 numbers or lowercase letters between a and f.
const SHA_REGEX = /^\b[0-9a-f]{5,40}\b$/;
let stdout;
try {
stdout = execSync('git rev-parse HEAD');
} catch (error) {
throw error;
}
const headCommitSHA = stdout.trim();
if (!SHA_REGEX.test(headCommitSHA)) {
throw new Error(`\`git rev-parse HEAD\` output is not a valid SHA1: ${headCommitSHA}`);
}
return headCommitSHA;
}
if (IS_PRODUCTION) { if (IS_PRODUCTION) {
const processEnv = {
NODE_ENV: JSON.stringify('production'),
};
processEnv.HEAD_COMMIT_SHA = getHeadCommitSHA();
config.devtool = 'source-map'; config.devtool = 'source-map';
config.plugins.push( config.plugins.push(
new webpack.NoEmitOnErrorsPlugin(), new webpack.NoEmitOnErrorsPlugin(),
...@@ -236,7 +209,7 @@ if (IS_PRODUCTION) { ...@@ -236,7 +209,7 @@ if (IS_PRODUCTION) {
sourceMap: true sourceMap: true
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': processEnv, 'process.env': { NODE_ENV: JSON.stringify('production') }
}), }),
new CompressionPlugin({ new CompressionPlugin({
asset: '[path].gz[query]', asset: '[path].gz[query]',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment