diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 77c516049e..30a06ca50b 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -865,7 +865,7 @@ export default class Component { } } else { if (node.type !== 'ExportNamedDeclaration') { - if (!parent) current_group = null; + if (!parent || parent.type === 'Program') current_group = null; } } }, diff --git a/test/runtime/samples/reactive-values-exported/_config.js b/test/runtime/samples/reactive-values-exported/_config.js new file mode 100644 index 0000000000..56220d3993 --- /dev/null +++ b/test/runtime/samples/reactive-values-exported/_config.js @@ -0,0 +1,18 @@ +export default { + props: { + x: 1 + }, + + html: ` +

1 1 1

+ `, + + test({ assert, component, target }) { + assert.equal(component.y, 1); + assert.equal(component.z, 1); + + component.x = 2; + assert.equal(component.y, 2); + assert.equal(component.z, 2); + } +}; diff --git a/test/runtime/samples/reactive-values-exported/main.svelte b/test/runtime/samples/reactive-values-exported/main.svelte new file mode 100644 index 0000000000..169fb7fcd8 --- /dev/null +++ b/test/runtime/samples/reactive-values-exported/main.svelte @@ -0,0 +1,10 @@ + + +

{x} {y} {z}