diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 30a06ca50b..9d13b5cd91 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -648,7 +648,7 @@ export default class Component { this.add_reference(name.slice(1)); const variable = this.var_lookup.get(name.slice(1)); - variable.subscribable = true; + if (variable) variable.subscribable = true; } else { this.add_var({ name, diff --git a/test/runtime/samples/store-auto-subscribe-missing-global/_config.js b/test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js similarity index 100% rename from test/runtime/samples/store-auto-subscribe-missing-global/_config.js rename to test/runtime/samples/store-auto-subscribe-missing-global-script/_config.js diff --git a/test/runtime/samples/store-auto-subscribe-missing-global-script/main.svelte b/test/runtime/samples/store-auto-subscribe-missing-global-script/main.svelte new file mode 100644 index 0000000000..210734b71d --- /dev/null +++ b/test/runtime/samples/store-auto-subscribe-missing-global-script/main.svelte @@ -0,0 +1,3 @@ + diff --git a/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js b/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js new file mode 100644 index 0000000000..c4eb72b553 --- /dev/null +++ b/test/runtime/samples/store-auto-subscribe-missing-global-template/_config.js @@ -0,0 +1,3 @@ +export default { + error: 'missingGlobal is not defined' +}; \ No newline at end of file diff --git a/test/runtime/samples/store-auto-subscribe-missing-global/main.svelte b/test/runtime/samples/store-auto-subscribe-missing-global-template/main.svelte similarity index 100% rename from test/runtime/samples/store-auto-subscribe-missing-global/main.svelte rename to test/runtime/samples/store-auto-subscribe-missing-global-template/main.svelte