ardatan/meteor-webpack

Uncaught TypeError: Cannot read property 'Mongo' of undefined

michaelcerne opened this issue · 5 comments

Hey there,

After testing both the React example and my own application, I'm coming across identical errors:

Uncaught TypeError: Cannot read property 'Mongo' of undefined

In the example, Webpack transpiles the code to:

var Tasks = exports.Tasks = new _mongo.Mongo.Collection('tasks');

It is attempting to read _mongo.Mongo, which I'm fairly certain isn't an object. This prevents the entire app from running. Any ideas as to why?

OS: Linux Mint 18.3

Thanks.

try to remove devServer field in your webpack.config file

@ardatan Looks like that fixed it. Thanks! Any way for me to keep native hot reload functions?

@michaelcerne you can remove ardatan:webpack-dev-middleware package, and devServer fields in your webpack.config. Then, you can work with Meteor's hot-code-push.

@ardatan Thank you. Is there any possibility that you can point me to why this error occurs at all?

It is a known issue. Browser loads scripts async. That's why. this error occurs if Webpack bundle is loaded before Meteor's one is loaded.
Generally this problem occurs in Firefox, not Chrome.