From 2c8bdd2f5fda04254551d04923ef91c79524282f Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 10 Aug 2018 10:41:12 -0700 Subject: Fix stacktraces in deno_ns --- src/from_filesystem.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/from_filesystem.cc') diff --git a/src/from_filesystem.cc b/src/from_filesystem.cc index 797659de0..fa50c0515 100644 --- a/src/from_filesystem.cc +++ b/src/from_filesystem.cc @@ -1,4 +1,5 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. +// This file is used to load the bundle at start for deno_ns. #include #include #include @@ -17,6 +18,9 @@ Deno* NewFromFileSystem(void* data, deno_recv_cb cb) { std::string js_source; CHECK(deno::ReadFileToString(BUNDLE_LOCATION, &js_source)); + std::string js_source_map; + CHECK(deno::ReadFileToString(BUNDLE_MAP_LOCATION, &js_source_map)); + Deno* d = new Deno; d->currentArgs = nullptr; d->cb = cb; @@ -32,7 +36,11 @@ Deno* NewFromFileSystem(void* data, deno_recv_cb cb) { { v8::HandleScope handle_scope(isolate); auto context = v8::Context::New(isolate); - InitializeContext(isolate, context, BUNDLE_LOCATION, js_source, nullptr); + // BUNDLE_LOCATION is absolute so deno_ns can load the bundle independently + // of the cwd. However for source maps to work, the bundle location relative + // to the build path must be supplied: BUNDLE_REL_LOCATION. + InitializeContext(isolate, context, BUNDLE_REL_LOCATION, js_source, + &js_source_map); d->context.Reset(d->isolate, context); } -- cgit v1.2.3