-
-
Save bretthadley/681995e3081758bf8f32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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