Why does require return an empty object?

I was trying to use showdown with webpack.

Showdown has this node specific code, and it failed as webpack returned an empty object for the var fs = require('fs'); call. Why is that so? Shouldn’t it return null or undefined?

I can appreciate that Showdown wasn’t written with webpack in mind, but I imagine there is lot’s of code out there, doing the same exact thing.

So, do I need to patch showdown, or is there some change in webpack that will solve this? Thanks!

Author: Fantashit

2 thoughts on “Why does require return an empty object?

Comments are closed.