Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 4558d65

Browse files
author
Brandon Dail
committed
Use WebpackDevServer API instead of CLI
So we can run the demo on heroku
1 parent 8ace87b commit 4558d65

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
src
22
test
33
demo
4+
Procfile

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: npm run demo:prod
1+
web: npm run demo

demo/server.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const WebpackDevServer = require('webpack-dev-server');
2+
const webpack = require('webpack');
3+
const config = require('./webpack.config');
4+
5+
const port = process.env.PORT || 3000;
6+
7+
var server = new WebpackDevServer(webpack(config), {
8+
contentBase: 'demo',
9+
stats: {
10+
colors: true,
11+
},
12+
});
13+
14+
server.listen(port, function() {});

demo/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
output: {
77
path: __dirname,
88
filename: 'bundle.js',
9+
publicPath: __dirname
910
},
1011
module: {
1112
loaders: [{

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"build-dist-min": "NODE_ENV=production webpack",
1515
"prepublish": "npm run test && npm run build && npm run dist",
1616
"clean-dist": "rimraf dist && mkdir dist",
17-
"demo": "webpack-dev-server --hot --inline --port 3000 --config demo/webpack.config.js --content-base demo",
18-
"demo:prod": "webpack-dev-server --hot --inline --port 80 --config demo/webpack.config.js --content-base demo"
17+
"demo": "node demo/server"
1918
},
2019
"keywords": [
2120
"react",

0 commit comments

Comments
 (0)