Skip to content

Instantly share code, notes, and snippets.

@chriszhangusc
Created March 25, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriszhangusc/bad3d1bd7f289814b0e9556870c6bcdc to your computer and use it in GitHub Desktop.
Save chriszhangusc/bad3d1bd7f289814b0e9556870c6bcdc to your computer and use it in GitHub Desktop.
// Currently not active
// Webpack1 config for production
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: [
path.resolve(__dirname, 'client', 'index.jsx'),
],
// If confused: https://github.com/webpack/docs/wiki/configuration#outputpublicpath
output: {
// Base path: ./public/build/
path: path.join(__dirname, 'public', 'build'),
filename: 'bundle.js',
publicPath: '/build/'
},
resolve: {
root: [
path.resolve(__dirname, './node_modules')
],
alias: {
client: path.resolve(__dirname, './client'),
assets: path.resolve(__dirname, './public')
},
extensions: ['', '.js', '.jsx', 'stage-0'],
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: false
}
}),
// Make sure environment variables are also accessible in client side.
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
],
module: {
loaders: [
{
loaders: ['react-hot', 'babel-loader'],
test: /\.jsx?$/,
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
},
{
test: /\.(jpe?g|png|ttf|eot|svg|woff(2)?)(\S+)?$/,
loader: 'file-loader?name=[name].[ext]'
}
]
},
devtool: 'cheap-module-source-map'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment