Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle is returning empty object #67

Closed
Industrial opened this issue Mar 15, 2018 · 3 comments
Closed

Bundle is returning empty object #67

Industrial opened this issue Mar 15, 2018 · 3 comments

Comments

@Industrial
Copy link
Contributor

Hi. I needed this PR to be able to run my new setup: Babel7 (+ TypeScript), Webpack4, React + Redux, SSR and HMR (universal). It's at https://github.com/Industrial/universal-demo

Could you please try git clone https://github.com/Industrial/universal-demo; cd universal-demo; npm i; npm run start; and then open http://localhost:3000 ?

I am getting the error

Error: The 'server' compiler must export a function in the form of `(options) => (req, res, next) => void`
    at getServerRenderer (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack-hot-server-middleware/src/index.js:68:15)
    at doneHandler (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack-hot-server-middleware/src/index.js:159:30)
    at SyncHook.eval (eval at create (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/tapable/lib/HookCodeFactory.js:17:12), <anonymous>:9:1)
    at SyncHook.lazyCompileHook [as _call] (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/tapable/lib/Hook.js:35:21)
    at MultiCompiler.compiler.hooks.done.tap.stats (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack/lib/MultiCompiler.js:45:22)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:18:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/tapable/lib/Hook.js:35:21)
    at Watching._done (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack/lib/Watching.js:99:28)
    at compiler.emitRecords.err (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack/lib/Watching.js:73:19)
    at Compiler.emitRecords (/home/tom/Code/Code9/JavaScript/Projects/universal-demo/node_modules/webpack/lib/Compiler.js:295:39)

I don't know what I'm doing wrong anymore :-(

@Industrial
Copy link
Contributor Author

$ node
> x=require('./dist/server.js')
{}
>

@richardscarrott
Copy link
Member

@Industrial You're missing libraryTarget in your webpack server config https://github.com/60frames/webpack-hot-server-middleware/blob/master/example/webpack.config.js#L24

@Industrial
Copy link
Contributor Author

Right, got it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants