Skip to content

Commit 156e585

Browse files
authored
Improve missing filescope error (#166)
1 parent a6177b4 commit 156e585

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/mean-olives-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/css': patch
3+
---
4+
5+
Improve missing filescope error

packages/css/src/fileScope.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dedent from 'dedent';
12
import { onEndFileScope } from './adapter';
23
import type { FileScope } from './types';
34

@@ -22,7 +23,12 @@ export function endFileScope() {
2223
export function getFileScope(): FileScope {
2324
if (fileScopes.length === 0) {
2425
throw new Error(
25-
'New styles cannot be registered dynamically after initial boot. This is to ensure that styles are statically extractible.',
26+
dedent`
27+
Styles were unable to be assigned to a file. This is generally caused by one of the following:
28+
29+
- You may have created styles outside of a '.css.ts' context
30+
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/setup
31+
`,
2632
);
2733
}
2834

0 commit comments

Comments
 (0)