paypal / react-engine

a composite render engine for universal (isomorphic) express apps to render both plain react views and react-router views
Apache License 2.0
1.45k stars 130 forks source link

'history' dependency missing from package.json is causing an error with browserify. #160

Closed apomortsev closed 7 years ago

apomortsev commented 8 years ago

After updating react-engine to @3.4.1 browserify started throwing this error:

Error: Cannot find module 'history' from '<...>/node_modules/react-engine/lib'
    at <...>/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
    at process (<...>/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
    at ondir (<...>/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
    at load (<...>/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex (<...>/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at <...>/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

There is a dependency on package 'history' in lib/client.js:62 that is not reflected in react-engine package.json. The main application does not explicitly depend on 'history' so the package is not in application's node_modules/ either and so cannot be found.

Thanks.

jonathansamines commented 7 years ago

@apomortsev I think the reason why is not included, is because is "optional" and as far as I know there is no way to specify "optional peer dependencies". You should have to install that dependency by yourself.

See: https://github.com/mjackson/history

apomortsev commented 7 years ago

Thank you @jonathansamines.