start to add production webpack
This commit is contained in:
parent
8aeb46130e
commit
248744b186
4 changed files with 59 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
|
"start": "BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
|
||||||
"lint": "eslint client server",
|
"lint": "eslint client server",
|
||||||
|
"build": "NODE_ENV=production webpack --config webpack.config.prod.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "Cassie Tarakajian",
|
"author": "Cassie Tarakajian",
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
"eslint-plugin-import": "^1.9.2",
|
"eslint-plugin-import": "^1.9.2",
|
||||||
"eslint-plugin-jsx-a11y": "^1.5.3",
|
"eslint-plugin-jsx-a11y": "^1.5.3",
|
||||||
"eslint-plugin-react": "^5.2.2",
|
"eslint-plugin-react": "^5.2.2",
|
||||||
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.8.5",
|
||||||
"node-sass": "^3.7.0",
|
"node-sass": "^3.7.0",
|
||||||
"nodemon": "^1.9.2",
|
"nodemon": "^1.9.2",
|
||||||
|
|
|
@ -9,7 +9,7 @@ import path from 'path';
|
||||||
|
|
||||||
// Webpack Requirements
|
// Webpack Requirements
|
||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import config from '../webpack.config';
|
import config from '../webpack.config.dev';
|
||||||
import webpackDevMiddleware from 'webpack-dev-middleware';
|
import webpackDevMiddleware from 'webpack-dev-middleware';
|
||||||
import webpackHotMiddleware from 'webpack-hot-middleware';
|
import webpackHotMiddleware from 'webpack-hot-middleware';
|
||||||
|
|
||||||
|
|
56
webpack.config.prod.js
Normal file
56
webpack.config.prod.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
var webpack = require('webpack');
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: {
|
||||||
|
app: [
|
||||||
|
'./client/index.js'
|
||||||
|
],
|
||||||
|
vendor: [
|
||||||
|
'react',
|
||||||
|
'react-dom'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: __dirname + '/dist',
|
||||||
|
filename: 'bundle.js',
|
||||||
|
publicPath: '/dist/'
|
||||||
|
},
|
||||||
|
|
||||||
|
resolve: {
|
||||||
|
extensions: ['', '.js', '.jsx'],
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{
|
||||||
|
test: /\.scss$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: ExtractTextPlugin.extract('style', 'css?importLoaders=2&sourceMap!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true!postcss-loader')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'babel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.svg$/,
|
||||||
|
loader: 'file'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': {
|
||||||
|
'NODE_ENV': JSON.stringify('production')
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
|
compressor: {
|
||||||
|
warnings: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
Loading…
Reference in a new issue