Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const debug = process.env.NODE_ENV !== "production";
- const webpack = require('webpack');
- const path = require('path');
- module.exports = {
- devtool: debug ? 'inline-sourcemap' : null,
- entry: 'webpack-hot-middleware/client',
- devServer: {
- inline: true,
- port: 3333,
- hot: true,
- contentBase: "src/static/",
- historyApiFallback: {
- index: '/index-static.html'
- }
- },
- output: {
- path: path.join(__dirname, 'src', 'static', 'js'),
- publicPath: "/js/",
- filename: 'bundle.js'
- },
- module: {
- loaders: [{
- test: path.join(__dirname, 'src'),
- loader: ['babel-loader'],
- query: {
- cacheDirectory: 'babel_cache',
- presets: debug ? ['react', 'es2015', 'react-hmre'] : ['react', 'es2015']
- }
- }]
- },
- plugins: debug ? [] : [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
- }),
- new webpack.HotModuleReplacementPlugin(),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.OccurenceOrderPlugin(),
- new webpack.NoErrorsPlugin(),
- new webpack.optimize.UglifyJsPlugin({
- compress: { warnings: false },
- mangle: true,
- sourcemap: false,
- beautify: false,
- dead_code: true
- }),
- ]
- };
Add Comment
Please, Sign In to add comment