Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.


See original GitHub issue
const SERVER = require("./www/server.bundle").default;
const express = require("express");
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
// const webpackHotServerMiddleware = require('webpack-hot-server-middleware');
const app = express();
const PORT = 3000;
const compiler = webpack(require('./build/webpack/prod.js'));
app.use(webpackHotMiddleware(compiler.compilers.find(compiler => === 'client')));
// app.use(webpackHotServerMiddleware(compiler));
app.listen(PORT, console.log.bind("listening at http://localhost:" + PORT));

If I uncomment the lines (webpackHotServerMiddleware itself) above, my build errors

			throw new MemoryFileSystemError(errors.code.EISDIR, _path);
    at MemoryFileSystem.readFileSync (/home/cescoferraro/code/go/src/
    at MultiCompiler.multiCompiler.plugin.multiStats (/home/cescoferraro/code/go/src/
    at MultiCompiler.applyPlugins (/home/cescoferraro/code/go/src/
    at MultiCompiler.<anonymous> (/home/cescoferraro/code/go/src/
    at Compiler.applyPlugins (/home/cescoferraro/code/go/src/
    at Watching._done (/home/cescoferraro/code/go/src/
    at /home/cescoferraro/code/go/src/
    at Compiler.emitRecords (/home/cescoferraro/code/go/src/
    at /home/cescoferraro/code/go/src/
    at /home/cescoferraro/code/go/src/
    at next (/home/cescoferraro/code/go/src/
    at Compiler.<anonymous> (/home/cescoferraro/code/go/src/
    at Compiler.applyPluginsAsyncSeries1 (/home/cescoferraro/code/go/src/
    at Compiler.afterEmit (/home/cescoferraro/code/go/src/
    at Compiler.<anonymous> (/home/cescoferraro/code/go/src/
    at /home/cescoferraro/code/go/src/

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

cescoferrarocommented, Jan 24, 2017

@richardsarrott That’s what I am doing. I just created the express chunk to see if could bundle everything with webpack to get cool syntax, but you are right. It’s not worth it.

cescoferrarocommented, Jan 26, 2017

I ended up doing

const env = process.env.NODE_ENV || 'development';
entry: {
	server: [env === "production" ? "./src/server" : "./src/middleware"]

So with NODE_ENV=production I endup with a single server bundle with all the dependencies. Its especially good for docker, because instead of doing

FROM  mhart/alpine-node:6
RUN npm init -y
RUN npm i express morgan
WORKDIR /srv/spotify
ADD src/hot.js /srv/spotify/hot.js
ADD www/ /srv/spotify/www
CMD ["node","hot.js"]

I can

FROM  mhart/alpine-node:base-6
WORKDIR /srv/spotify
ADD www/ /srv/spotify/www
CMD ["node","www/server.bundle.js"]

For this the client/middleware/server.tsx files live inside the src dir while I keep a hot.js file on my root. Not having hmr logic inside the app source code makes sense for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are System Error Memory Dump Files in Windows 11/10?
System Error Memory Dump Files are basically error logs that are created whenever your computer crashes. They can hold small amount of ...
Read more >
How to Fix This Error: Memory Card Shows Invalid File System
You will need to repair/format raw memory card or recover your data back. Solutions: Memory Card Shows Invalid File System (RAW). 1. Format...
Read more >
Memory fs error on windows ==> throw new ... - GitHub
I'm trying to use this package on windows but i keep getting error : throw new MemoryFileSystemError(errors.code.ENOENT, _path).
Read more >
How to Fix a File System Error in Windows 10 (Full Guide)
How to fix a file system error on Windows 10 · 1. Check for Windows Updates · 4. Run CHKDSK · 5. Use...
Read more >
Fix: The Volume Does Not Contain a Recognized File System ...
This page shows you how to fix The volume does not contain a recognized file system in Windows 10/8/7 with EaseUS RAW drive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found