Skip to content

how to run a simple production server #1146

Closed
@awb99

Description

@awb99
  • Operating System: debian
  • Node Version:8.7
  • NPM Version:5.4.2
  • webpack Version: 1.15.0
  • webpack-dev-server Version:1.16.5

I dont understand a feature:
I read all the docs, and cannot find how I could server the bundle.js file once I have built the bundle for production. I tried this but it does not work:

var fs = require('fs'),
    path = require('path'),
    express = require('express'); 

var app = express();
app.use(express.static('public')); 

// http
var http = require('http');
var httpServer = http.createServer(app);
var port = 9090;
httpServer.listen(port);
console.log('cititrip priccing  starting http-port: ' + port );

It loads the index.html, but then I dont know how it gets the react router to work.

I am somehow forced to do this, because there is an issue in serving bigger bundles via the webpack-dev-server. #1044

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions