pbojinov
3/17/2016 - 7:13 PM

universal-react webpack config

universal-react webpack config

'use strict';

const path = require('path');
const webpack = require('webpack');

module.exports = {
    devtool: '#source-map',
    entry: [
        'webpack-hot-middleware/client',
        './app/index.js'
    ],
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'app.js'
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ],
    module: {
        loaders: [{
            test: /\.css$/,
            loader: 'style!css?modules',
            include: /flexboxgrid/,
        }, {
            test: /\.js?$/,
            loader: 'babel',
            include: path.join(__dirname, 'app'),
            query: {
                plugins: [
                    ['react-transform', {
                        'transforms': [{
                            transform: 'react-transform-hmr',
                            // If you use React Native, pass 'react-native' instead:
                            imports: ['react'],
                            // This is important for Webpack HMR:
                            locals: ['module']
                        }]
                    }],
                    ['transform-object-assign']
                ]
            }
        }]
    }
};