Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy Option with React Hot Middleware #16

Closed
nsmith7989 opened this issue Sep 14, 2015 · 1 comment
Closed

Proxy Option with React Hot Middleware #16

nsmith7989 opened this issue Sep 14, 2015 · 1 comment

Comments

@nsmith7989
Copy link

The example for webpack.react-transform-webpack-hmr works perfectly. However I'm getting 404 errors when I try to use this with the proxy option.

server.js

var webpack = require('webpack');
var config = require('./webpack.config');
var browserSync = require('browser-sync');
var compiler = webpack(config);

browserSync({
    proxy: {
        target: 'proxy-traget.dev',
        middleware: [
            require('webpack-dev-middleware')(compiler, {
                noInfo: true, publicPath: config.output.publicPath
            }),
            require("webpack-hot-middleware")(compiler)
        ]
    },
    files: [
        'css/style.css',
        '**/*.php'
    ]
});

webpack config:

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

module.exports = {
    devtool: 'eval-source-map',

    entry: {
        truckFilter: [
            'webpack-hot-middleware/client?reload=true',
            './js/index.js'
        ]
    },

    output: {
        path: path.join(__dirname, 'js/build'),
        publicPath: "js/build",
        filename: "bundle.js"
    },

    // Require the webpack and react-hot-loader plugins
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin(),
        new webpack.DefinePlugin({
            __DEV__: true
        }),
    ],

    resolve: {
        extensions: ['', '.js', '.jsx']
    },

    module: {
        // Load the react-hot-loader
        loaders: [ {
            test: /\.jsx?$/,
            loaders: ['babel'],
            include: path.join(__dirname, 'js')
        } ]
    },

};

Everything loads fine except localhost:3000/__webpack_hmr which 404s. Is the proxy setting sending that request to my proxy (php) server, or is it sending it to browser sync?

@nsmith7989
Copy link
Author

Nevermind. This was a problem with webpack-hot-middlware, which has since been fixed:

webpack-contrib/webpack-hot-middleware@dfb7efb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant