Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remote-http-middleware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remote-http-middleware

Webpack dev server middleware for requiring http an address and inject bundle.js

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Webpack-dev-server middleware for requiring remote http an address and inject bundle.js

This project is a webpack-dev-server middleware that inject bundle.js (or other configurable paths) in a remote page locally.

If you have a local server that render a jinja2 template (or other template rendering) running on port 3001, you can inject bundle.js in any page served by this address for development purposes and use webpack with livereload.

Ex:

$ curl 'http://localhost:3001/hello-world'
<html>
  <body>Hello world</body>
</html>

After install this project on your webpack-dev-server running locally on port 3000:

Ex:

$ curl 'http://localhost:3001/real-server/http://localhost:3001/hello-world'
<html>
  <body>
    Hello world
    <script type="text/javascript" src="/static/js/bundle.js"></script>
  </body>
</html>

How to use?

Install with npm:

$ npm install remote-http-middleware

So, on your webpackDevServer.config.js you need to install on your app using app.use() like:

const HtmlWebpackPlugin = require('html-webpack-plugin');
const remoteHTTPMiddleware = require('remote-http-middleware');

    ...

module.exports = function (proxy, allowedHost) {
  return {
      ...

    before(app) {
        ...

      app.use(remoteHTTPMiddleware({
        plugins: config.plugins,
        HtmlWebpackPlugin: HtmlWebpackPlugin,
        assets: {
          manifest: false,
          js: [`${config.output.publicPath || ""}${config.output.filename}`],
          css: [],
        }
      }));
    },
  };
};

License

MIT (http://www.opensource.org/licenses/mit-license.php)

FAQs

Package last updated on 05 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc