score:2

Accepted answer
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const webpack = require('webpack');

module.exports = {
    entry: {
        main: './src/scripts/main.js',
        engine: './src/scripts/engine/Engine.js',
        debugger: './src/scripts/debug/Debugmain.js',
        client: './src/scripts/clientcode/Client.js'
    },
    output: {
        path: path.resolve('./dist/client'),
        filename: '[name].js',
        publicPath: '/dist/client/',
        chunkFilename: '[name].js'
    },
    devtool: 'inline-sourcemap',
    cache: true,
    resolve: {
        alias: { ByteBuffer: 'bytebuffer' }
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'react-hot-loader'
            },
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel-loader',
                query: {
                    cacheDirectory: true,
                    presets: ['react', 'es2015'],
                    compact: false
                }
            },
            {
                enforce: 'pre',
                test: /\.(js|jsx)$/,
                exclude: /node_modules/,
                include: [path.join(__dirname, './src', 'scripts')],
                loader: 'eslint-loader'
            },
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    loader: 'css-loader?sourceMap!less-loader?sourceMap'
                })
            },
            {
                test: /\.(eot|woff|woff2|ttf|otf|png|jpg)$/,
                loader: 'file-loader?name=images/[name].[ext]'
            }
        ]
    },
    devServer: {
        port: 8080,
        stats: 'errors-only',
        proxy: {
            '/api': {
                target: 'http://localhost:20404', //http://localhost:20403/',
                secure: false
            }
        },
        historyApiFallback: {
            index: 'debug.html'
        }
    },
    plugins: [
        new ExtractTextPlugin({
            filename: './styles/main.css',
            allChunks: true
        })
    ],
    resolve: {
        modules: ['src/scripts', 'node_modules'],
        extensions: ['.jsx', '.js'],
        unsafeCache: true,
        alias: {
            components: path.resolve(__dirname, 'src', 'scripts', 'components'),
            routes: path.resolve(__dirname, '.', 'routes'),
            draggable_tab: path.resolve(__dirname, 'src', 'scripts', 'lib'),
            utils: path.resolve(__dirname, 'src', 'scripts', 'utils'),
            engine: path.resolve(__dirname, 'src', 'scripts', 'engine')
        }
    }
};

Related Query

More Query from same tag