summaryrefslogtreecommitdiff
path: root/libdeno/api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libdeno/api.cc')
-rw-r--r--libdeno/api.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/libdeno/api.cc b/libdeno/api.cc
index 6ee2c934f..c059bb534 100644
--- a/libdeno/api.cc
+++ b/libdeno/api.cc
@@ -36,6 +36,11 @@ Deno* deno_new(deno_buf snapshot, deno_buf shared, deno_recv_cb cb) {
v8::MaybeLocal<v8::Value>(),
v8::DeserializeInternalFieldsCallback(
deno::DeserializeInternalFields, nullptr));
+ if (!snapshot.data_ptr) {
+ // If no snapshot is provided, we initialize the context with empty
+ // main source code and source maps.
+ deno::InitializeContext(isolate, context, "", "", "");
+ }
d->context_.Reset(isolate, context);
}