Why does Meteor hide Node require() from server-side code?

I was trying to make a plugin to run Webpack. However, since webpack.config.js files commonly require() things, the only way to read the config and pass it into Webpack is to require() the webpack.config.js.

However, it seems Meteor calls my plugin in some scope where require() has been undefined? There’s no good reason for this, it’s running in Node. I’m guessing the idea was to discourage people from writing packages where whoops, you thought it would work on the client side but it doesn’t? I say whatever, that’s package writers’ problem to solve.

1 Like