Vendor hash support in prod config - Fixes #493 (#571)

* config: file styling

* config: update vendor files order

* config: webpack prod - add vendor hash support

* fix: remove submodule
This commit is contained in:
Dhruvdutt Jadhav 2018-02-27 01:20:13 +05:30 committed by Cassie Tarakajian
parent 287663494a
commit 4628b38be0
2 changed files with 47 additions and 47 deletions

View file

@ -1,4 +1,4 @@
var webpack = require('webpack');
const webpack = require('webpack');
require('dotenv').config();
module.exports = {
@ -14,7 +14,7 @@ module.exports = {
]
},
output: {
path: __dirname + '/dist/',
path: `${__dirname}/dist/`,
filename: 'app.js',
publicPath: '/dist/'
},
@ -34,15 +34,15 @@ module.exports = {
}),
new webpack.DefinePlugin({
'process.env': {
API_URL: process.env.API_URL ? '"' + process.env.API_URL + '"' : undefined,
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
CLIENT: JSON.stringify(true),
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
JSON.stringify(true) :
JSON.stringify(false),
'NODE_ENV': JSON.stringify('development'),
'S3_BUCKET': process.env.S3_BUCKET ? '"' + process.env.S3_BUCKET + '"' : undefined,
'S3_BUCKET_URL_BASE': process.env.S3_BUCKET_URL_BASE ? '"' + process.env.S3_BUCKET_URL_BASE + '"' : undefined,
'AWS_REGION': process.env.AWS_REGION ? '"' + process.env.AWS_REGION + '"': undefined
NODE_ENV: JSON.stringify('development'),
S3_BUCKET: process.env.S3_BUCKET ? `"${process.env.S3_BUCKET}"` : undefined,
S3_BUCKET_URL_BASE: process.env.S3_BUCKET_URL_BASE ? `"${process.env.S3_BUCKET_URL_BASE}"` : undefined,
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
}
})
],

View file

@ -1,11 +1,11 @@
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ManifestPlugin = require('webpack-manifest-plugin');
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
var cssnext = require('postcss-cssnext');
var postcssFocus = require('postcss-focus');
var postcssReporter = require('postcss-reporter');
var cssnano = require('cssnano');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
const cssnext = require('postcss-cssnext');
const postcssFocus = require('postcss-focus');
const postcssReporter = require('postcss-reporter');
const cssnano = require('cssnano');
require('dotenv').config();
module.exports = {
@ -17,27 +17,27 @@ module.exports = {
'./client/index.jsx'
],
vendor: [
'react',
'react-dom',
'redux',
'codemirror',
'moment',
'redux-form',
'react-redux',
'dropzone',
'axios',
'classnames',
'react-inlinesvg',
'react-router',
'redux-thunk',
'codemirror',
'csslint',
'jshint',
'dropzone',
'htmlhint',
'js-beautify',
'jshint',
'moment',
'react-dom',
'react-inlinesvg',
'react-redux',
'react-router',
'react',
'redux-form',
'redux-thunk',
'redux',
]
},
output: {
path: __dirname + '/static/dist',
path: `${__dirname}/static/dist`,
filename: '[name].[chunkhash].js',
publicPath: '/dist/'
},
@ -79,25 +79,25 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
'process.env': {
'API_URL': process.env.API_URL ? '"' + process.env.API_URL + '"' : undefined,
'NODE_ENV': JSON.stringify('production'),
'S3_BUCKET': process.env.S3_BUCKET ? '"' + process.env.S3_BUCKET + '"' : undefined,
'S3_BUCKET_URL_BASE': process.env.S3_BUCKET_URL_BASE ? '"' + process.env.S3_BUCKET_URL_BASE + '"' : undefined,
'AWS_REGION': process.env.AWS_REGION ? '"' + process.env.AWS_REGION + '"': undefined
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
NODE_ENV: JSON.stringify('production'),
S3_BUCKET: process.env.S3_BUCKET ? `"${process.env.S3_BUCKET}"` : undefined,
S3_BUCKET_URL_BASE: process.env.S3_BUCKET_URL_BASE ? `"${process.env.S3_BUCKET_URL_BASE}"` : undefined,
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.js',
filename: '[name].[chunkhash].js',
}),
new ExtractTextPlugin({ filename: 'app.[chunkhash].css', allChunks: true }),
new ManifestPlugin({
basePath: '/',
}),
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest",
filename: 'chunk-manifest.json',
manifestVariable: 'webpackManifest',
}),
new webpack.optimize.UglifyJsPlugin({
compress: {