Don't make prepareStackTrace unwritable

This breaks other code (such as Grim) that may want to temporarily
use a different prepareStackTrace function.
This commit is contained in:
Max Brunsfeld
2015-08-21 14:57:39 -07:00
parent a6fa098a8c
commit a18b7e2fa9
2 changed files with 6 additions and 9 deletions

View File

@@ -20,7 +20,13 @@ exports.getCachePath = function(sourceCode) {
exports.compile = function(sourceCode, filePath) {
if (!CoffeeScript) {
var previousPrepareStackTrace = Error.prepareStackTrace
CoffeeScript = require('coffee-script')
// When it loads, coffee-script reassigns Error.prepareStackTrace. We have
// already reassigned it via the 'source-map-support' module, so we need
// to set it back.
Error.prepareStackTrace = previousPrepareStackTrace
}
var output = CoffeeScript.compile(sourceCode, {

View File

@@ -138,15 +138,6 @@ require('source-map-support').install({
}
})
// This prevents coffee-script from reassigning `Error.prepareStackTrace` when
// it is loaded.
Object.defineProperty(Error, 'prepareStackTrace', {
value: Error.prepareStackTrace,
configurable: false,
enumerable: true,
writable: false
})
Object.keys(COMPILERS).forEach(function (extension) {
var compiler = COMPILERS[extension]