← All tasks
javascriptemotion-js/emotion #1062Not a task: not reproduced

[primitives] [emotion 10] Sketch example: "Can't find variable: document"

envgap__emotion-js__emotion-1062

01 / FAILURE SIGNATURE

As reported upstream

The following error occured: `ReferenceError: Can't find variable: document`. Traced back to packages/cache/src/index.js  -> line 70 : at the  createCache method.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
b966abd80cc4817cd27f2e4e6c7994cb2faf9043
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

emotion-js/emotion #1062 · read the original issue
- `emotion` 10.0.0:



**Relevant code.**



Sketch Example at https://github.com/emotion-js/emotion/tree/master/packages/primitives



**What you did:**



I tried out the example.



**What happened:**



The following error occured: `ReferenceError: Can't find variable: document`. Traced back to packages/cache/src/index.js  -> line 70 : at the  createCache method.



**Problem description:**



This problem is not specifically caused by the primitives package but rather by the @emotion/cache package. The skpm builder internally uses webpack and is configured to use look for "browser" field in all the packages. The resulting browser build strips out the `if (isBrowser)` statements.



We could argue that the skpm builder uses an invalid webpack configuration and should exclude "browser" from the mainFields, but unfortunately this introduces a lot of errors.



Suggested solution:



I got the example working by removing the `browser` field from packages/cache/package.json.

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]