Repository: sveltejs/svelte (JavaScript)
Task: Refactoring (2019-02-17 17:36:20+00:00)

Issue:
Proposal: `dev: true` only affects runtime warnings and errors
Right now, compiling with `dev: true` causes the compiler to emit a bunch of code to display additional runtime warnings and errors, to assist with debugging - and it also enables a compile-time warning for empty blocks. As far as I can tell, the empty blocks warning is the only compiler-time thing it affects.

This seems weird, and I think it would be nicer if `dev: true` _only_ affected runtime things. This would mean that the empty block compile-time warning would always be emitted - so this issues can go along with #2040, which makes it simpler to suppress specific warnings at compile time.


Discussion:

Patch:
diff --git a/src/compile/nodes/shared/Node.ts b/src/compile/nodes/shared/Node.ts
--- a/src/compile/nodes/shared/Node.ts
+++ b/src/compile/nodes/shared/Node.ts
@@ -49,7 +49,6 @@ export default class Node {
 	}
 
 	warnIfEmptyBlock() {
-		if (!this.component.compileOptions.dev) return;
 		if (!/Block$/.test(this.type) || !this.children) return;
 		if (this.children.length > 1) return;
 


Test patch:
diff --git a/test/validator/samples/empty-block-dev/_config.js b/test/validator/samples/empty-block-dev/_config.js
deleted file mode 100644
--- a/test/validator/samples/empty-block-dev/_config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default {
-	dev: true
-};
\ No newline at end of file
diff --git a/test/validator/samples/empty-block-prod/input.svelte b/test/validator/samples/empty-block-prod/input.svelte
deleted file mode 100644
--- a/test/validator/samples/empty-block-prod/input.svelte
+++ /dev/null
@@ -1,5 +0,0 @@
-{#each things as thing}
-
-{/each}
-
-{#each things as thing}{/each}
\ No newline at end of file
diff --git a/test/validator/samples/empty-block-prod/warnings.json b/test/validator/samples/empty-block-prod/warnings.json
deleted file mode 100644
--- a/test/validator/samples/empty-block-prod/warnings.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
\ No newline at end of file
diff --git a/test/validator/samples/empty-block-dev/input.svelte b/test/validator/samples/empty-block/input.svelte
similarity index 100%
rename from test/validator/samples/empty-block-dev/input.svelte
rename to test/validator/samples/empty-block/input.svelte
diff --git a/test/validator/samples/empty-block-dev/warnings.json b/test/validator/samples/empty-block/warnings.json
similarity index 100%
rename from test/validator/samples/empty-block-dev/warnings.json
rename to test/validator/samples/empty-block/warnings.json