Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Best way to monkey patch Ember internals?

$
0
0

@ryanto wrote:

Every so often I find myself in a situation where I’m tracking down a bug and I want to monkey patch some internal Ember function, usually as a temporary or debug fix.

Today I’m in a situation where I need to change this function: https://github.com/emberjs/data/blob/ced0cdfe9c410575adb0034ea06bf4f51fd9e4ab/addon/-private/utils/parse-response-headers.js - There’s a bug that causes it to not work correctly in fastboot.

I’ve been able to fix this with running fastboot + node debugger, but now I want to monkey patch it so I can deploy my application.

In the past, I would fork the Ember Data version tag my app is using and then point my package.json at that fork. However that’s cumbersome and hard to understand.

Earlier I noticed that the parseResponseHeaders is available in as a module in require.entries['ember-data/-private'].module.exports.parseResponseHeaders. This got me thinking… is it possible to monkey patch this function without needing an ED fork?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles