Skip to content

Instantly share code, notes, and snippets.

@bretthadley
Created December 17, 2015 09:00
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 bretthadley/681995e3081758bf8f32 to your computer and use it in GitHub Desktop.
Save bretthadley/681995e3081758bf8f32 to your computer and use it in GitHub Desktop.
import path from 'path';
import webpack, { DefinePlugin, BannerPlugin, HotModuleReplacementPlugin, NoErrorsPlugin } from 'webpack';
import merge from 'lodash/object/merge';
const DEBUG = !process.argv.includes('--release');
const GLOBALS = {
'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
__DEV__: DEBUG
};
const config = {
output: {
publicPath: '/',
sourcePrefix: ' '
},
cache: true,
debug: true,
plugins: [
new webpack.optimize.OccurenceOrderPlugin()
]
};
const appConfig = merge({}, config, {
entry: [
'webpack-hot-middleware/client',
'./src/client/app.js'
],
output: {
path: path.join(__dirname, '../build/public'),
filename: 'app.js'
},
devtool: 'cheap-module-eval-source-map',
plugins: [
...config.plugins,
new webpack.DefinePlugin(GLOBALS),
new HotModuleReplacementPlugin(),
new NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.js?$/,
include: [
path.resolve(__dirname, '../src')
],
loaders: ['react-hot', 'babel-loader']
}]
}
});
export default appConfig;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment