diff --git a/src/compile/Component.ts b/src/compile/Component.ts
index e2b7011622..3e76bf71b2 100644
--- a/src/compile/Component.ts
+++ b/src/compile/Component.ts
@@ -695,6 +695,7 @@ export default class Component {
});
hoistable_nodes.add(node);
+ this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
}
}
diff --git a/test/js/samples/hoisted-const/expected.js b/test/js/samples/hoisted-const/expected.js
new file mode 100644
index 0000000000..4613e724d7
--- /dev/null
+++ b/test/js/samples/hoisted-const/expected.js
@@ -0,0 +1,47 @@
+/* generated by Svelte vX.Y.Z */
+import { SvelteComponent as SvelteComponent_1, append, createElement, createText, detachNode, init, insert, noop, run, safe_not_equal } from "svelte/internal";
+
+function create_fragment(component, ctx) {
+ var b, text_value = get_answer(), text, current;
+
+ return {
+ c() {
+ b = createElement("b");
+ text = createText(text_value);
+ },
+
+ m(target, anchor) {
+ insert(target, b, anchor);
+ append(b, text);
+ current = true;
+ },
+
+ p: noop,
+
+ i(target, anchor) {
+ if (current) return;
+ this.m(target, anchor);
+ },
+
+ o: run,
+
+ d(detach) {
+ if (detach) {
+ detachNode(b);
+ }
+ }
+ };
+}
+
+const ANSWER = 42;
+
+function get_answer() { return ANSWER; }
+
+class SvelteComponent extends SvelteComponent_1 {
+ constructor(options) {
+ super();
+ init(this, options, noop, create_fragment, safe_not_equal);
+ }
+}
+
+export default SvelteComponent;
\ No newline at end of file
diff --git a/test/js/samples/hoisted-const/input.html b/test/js/samples/hoisted-const/input.html
new file mode 100644
index 0000000000..d248a83154
--- /dev/null
+++ b/test/js/samples/hoisted-const/input.html
@@ -0,0 +1,6 @@
+
+
+{get_answer()}
\ No newline at end of file