-
-
Save joepie91/7648c383b94f0888509182dbcea7739f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const path = require("path"); | |
const app = require("../src/server/app.js")(); | |
if (process.env.NODE_ENV === "development") { | |
const budo = require("budo"); | |
function projectPath(targetPath) { | |
return path.resolve(__dirname, "..", targetPath); | |
} | |
budo(projectPath("src/client/index.jsx"), { | |
watchGlob: projectPath("public/css/*.css"), | |
live: "**/*.css", | |
stream: process.stdout, | |
port: 8000, | |
/* NOTE: If the below is not set to match watchGlob, then livereloads will silently fail */ | |
dir: projectPath("public"), | |
serve: "js/bundle.js", | |
debug: true, | |
browserify: { | |
extensions: [".jsx"], | |
plugin: [ | |
"browserify-hmr" | |
], | |
transform: [ | |
["babelify", { | |
presets: ["@babel/preset-env", "@babel/preset-react"], | |
plugins: ["react-hot-loader/babel"] | |
}] | |
] | |
}, | |
middleware: function (req, res, next) { | |
app.handle(req, res, (err) => { | |
if (err != null && err instanceof Error) { | |
res.send("<pre>" + err.stack + "</pre>"); | |
} else { | |
next(err); | |
} | |
}); | |
} | |
}); | |
} else { | |
app.listen(3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment