diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 6322d420..24167419 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -1,12 +1,12 @@ -var webpack = require('webpack'); +const webpack = require('webpack'); require('dotenv').config(); module.exports = { - devtool: 'cheap-module-eval-source-map', - entry: { + devtool: 'cheap-module-eval-source-map', + entry: { app: ['babel-polyfill', - 'webpack-hot-middleware/client', - './client/index.jsx', + 'webpack-hot-middleware/client', + './client/index.jsx', ], vendor: [ 'react', @@ -14,9 +14,9 @@ module.exports = { ] }, output: { - path: __dirname + '/dist/', - filename: 'app.js', - publicPath: '/dist/' + path: `${__dirname}/dist/`, + filename: 'app.js', + publicPath: '/dist/' }, resolve: { extensions: ['.js', '.jsx'], @@ -25,7 +25,7 @@ module.exports = { 'node_modules' ] }, - plugins: [ + plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', @@ -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 } }) ], @@ -62,8 +62,8 @@ module.exports = { loader: 'file-loader' }, { - test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/, - loader: 'file-loader' + test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/, + loader: 'file-loader' } ], }, diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 3972c212..84ad6371 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -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/' }, @@ -70,8 +70,8 @@ module.exports = { loader: 'file-loader' }, { - test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/, - loader: 'file-loader' + test: /fonts\/.*\.(eot|svg|ttf|woff|woff2)$/, + loader: 'file-loader' } ] }, @@ -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: {