* config: file styling * config: update vendor files order * config: webpack prod - add vendor hash support * fix: remove submodule
This commit is contained in:
parent
287663494a
commit
4628b38be0
2 changed files with 47 additions and 47 deletions
|
@ -1,12 +1,12 @@
|
||||||
var webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'cheap-module-eval-source-map',
|
devtool: 'cheap-module-eval-source-map',
|
||||||
entry: {
|
entry: {
|
||||||
app: ['babel-polyfill',
|
app: ['babel-polyfill',
|
||||||
'webpack-hot-middleware/client',
|
'webpack-hot-middleware/client',
|
||||||
'./client/index.jsx',
|
'./client/index.jsx',
|
||||||
],
|
],
|
||||||
vendor: [
|
vendor: [
|
||||||
'react',
|
'react',
|
||||||
|
@ -14,9 +14,9 @@ module.exports = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: __dirname + '/dist/',
|
path: `${__dirname}/dist/`,
|
||||||
filename: 'app.js',
|
filename: 'app.js',
|
||||||
publicPath: '/dist/'
|
publicPath: '/dist/'
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.jsx'],
|
extensions: ['.js', '.jsx'],
|
||||||
|
@ -25,7 +25,7 @@ module.exports = {
|
||||||
'node_modules'
|
'node_modules'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
name: 'vendor',
|
name: 'vendor',
|
||||||
|
@ -34,15 +34,15 @@ module.exports = {
|
||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'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),
|
CLIENT: JSON.stringify(true),
|
||||||
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
|
FORCE_TO_HTTPS: process.env.FORCE_TO_HTTPS === 'true' ?
|
||||||
JSON.stringify(true) :
|
JSON.stringify(true) :
|
||||||
JSON.stringify(false),
|
JSON.stringify(false),
|
||||||
'NODE_ENV': JSON.stringify('development'),
|
NODE_ENV: JSON.stringify('development'),
|
||||||
'S3_BUCKET': process.env.S3_BUCKET ? '"' + process.env.S3_BUCKET + '"' : undefined,
|
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,
|
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
|
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@ -62,8 +62,8 @@ module.exports = {
|
||||||
loader: 'file-loader'
|
loader: 'file-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
||||||
loader: 'file-loader'
|
loader: 'file-loader'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
var webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
var ManifestPlugin = require('webpack-manifest-plugin');
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
var ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
|
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin');
|
||||||
var cssnext = require('postcss-cssnext');
|
const cssnext = require('postcss-cssnext');
|
||||||
var postcssFocus = require('postcss-focus');
|
const postcssFocus = require('postcss-focus');
|
||||||
var postcssReporter = require('postcss-reporter');
|
const postcssReporter = require('postcss-reporter');
|
||||||
var cssnano = require('cssnano');
|
const cssnano = require('cssnano');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -17,27 +17,27 @@ module.exports = {
|
||||||
'./client/index.jsx'
|
'./client/index.jsx'
|
||||||
],
|
],
|
||||||
vendor: [
|
vendor: [
|
||||||
'react',
|
|
||||||
'react-dom',
|
|
||||||
'redux',
|
|
||||||
'codemirror',
|
|
||||||
'moment',
|
|
||||||
'redux-form',
|
|
||||||
'react-redux',
|
|
||||||
'dropzone',
|
|
||||||
'axios',
|
'axios',
|
||||||
'classnames',
|
'classnames',
|
||||||
'react-inlinesvg',
|
'codemirror',
|
||||||
'react-router',
|
|
||||||
'redux-thunk',
|
|
||||||
'csslint',
|
'csslint',
|
||||||
'jshint',
|
'dropzone',
|
||||||
'htmlhint',
|
'htmlhint',
|
||||||
'js-beautify',
|
'js-beautify',
|
||||||
|
'jshint',
|
||||||
|
'moment',
|
||||||
|
'react-dom',
|
||||||
|
'react-inlinesvg',
|
||||||
|
'react-redux',
|
||||||
|
'react-router',
|
||||||
|
'react',
|
||||||
|
'redux-form',
|
||||||
|
'redux-thunk',
|
||||||
|
'redux',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: __dirname + '/static/dist',
|
path: `${__dirname}/static/dist`,
|
||||||
filename: '[name].[chunkhash].js',
|
filename: '[name].[chunkhash].js',
|
||||||
publicPath: '/dist/'
|
publicPath: '/dist/'
|
||||||
},
|
},
|
||||||
|
@ -70,8 +70,8 @@ module.exports = {
|
||||||
loader: 'file-loader'
|
loader: 'file-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/,
|
||||||
loader: 'file-loader'
|
loader: 'file-loader'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -79,25 +79,25 @@ module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'API_URL': process.env.API_URL ? '"' + process.env.API_URL + '"' : undefined,
|
API_URL: process.env.API_URL ? `"${process.env.API_URL}"` : undefined,
|
||||||
'NODE_ENV': JSON.stringify('production'),
|
NODE_ENV: JSON.stringify('production'),
|
||||||
'S3_BUCKET': process.env.S3_BUCKET ? '"' + process.env.S3_BUCKET + '"' : undefined,
|
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,
|
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
|
AWS_REGION: process.env.AWS_REGION ? `"${process.env.AWS_REGION}"` : undefined
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
name: 'vendor',
|
name: 'vendor',
|
||||||
minChunks: Infinity,
|
minChunks: Infinity,
|
||||||
filename: 'vendor.js',
|
filename: '[name].[chunkhash].js',
|
||||||
}),
|
}),
|
||||||
new ExtractTextPlugin({ filename: 'app.[chunkhash].css', allChunks: true }),
|
new ExtractTextPlugin({ filename: 'app.[chunkhash].css', allChunks: true }),
|
||||||
new ManifestPlugin({
|
new ManifestPlugin({
|
||||||
basePath: '/',
|
basePath: '/',
|
||||||
}),
|
}),
|
||||||
new ChunkManifestPlugin({
|
new ChunkManifestPlugin({
|
||||||
filename: "chunk-manifest.json",
|
filename: 'chunk-manifest.json',
|
||||||
manifestVariable: "webpackManifest",
|
manifestVariable: 'webpackManifest',
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: {
|
||||||
|
|
Loading…
Reference in a new issue