Coder Social home page Coder Social logo

Comments (4)

romanlex avatar romanlex commented on May 18, 2024

This version of package https://github.com/facebook/create-react-app/blob/next/packages/react-dev-utils/webpackHotDevClient.js
It used in create-react-app

from browser-sync-webpack-plugin.

Va1 avatar Va1 commented on May 18, 2024

hi @romanlex

i'm not sure i understand what you're trying to achieve. what is the reason for using package with webpackHotDevClient directly?

the code you sent (webpackHotDevClient) seems to be a client code for create-react-app implementation of webpack-dev-server. browser-sync itself has the similar code as it serves a similar purpose. for ones who want to use both browser-sync and webpack-dev-server simultaneously, there's an example in package docs. in this case nobody really cares for what browser-sync or webpack-dev-server really does on client, your just need to match ports and other options on backend.

from browser-sync-webpack-plugin.

romanlex avatar romanlex commented on May 18, 2024

this client has another link for RHL /sockjs-node but browser-sync-plugin doesn't has websocket proxy connection or support rewrite rules for this

new BrowserSyncPlugin(
          {
            host: HOST,
            port: port,
            notify: BROWSER_NOTIFY === 'true',
            open: BROWSER_OPEN === 'true',
            injectCss: true,
            https: process.env.HTTPS === 'true',
            logLevel: 'info',
            cors: true,
            proxy: {
              target: `${protocol}://${HOST}:${port + 1}`,
              ws: true,
            },
            ui: { port: port + 2 },
          },
          {
            reload: false,
          },
        ),

In my case I use nginx as proxy for all local domains and sockjs connection not work properly. May be this info help someone

location /sockjs-node {
        proxy_pass http://127.0.0.1:3001; // webpack hot client
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
location / {
        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header Connection "upgrade";
        proxy_set_header Upgrade $http_upgrade;
        
        proxy_read_timeout 300;
		proxy_send_timeout 300;
		
        proxy_buffering off;
        proxy_cache off;
        proxy_redirect  off;
        
        proxy_pass http://127.0.0.1:3000; // BrowserSync plugin
    }

from browser-sync-webpack-plugin.

Va1 avatar Va1 commented on May 18, 2024

sorry for delay. i'm glad you've figured this exotic use-case out. gonna close the issue now. thanks

from browser-sync-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.