FormidableLabs / FormidableLabs/spectacle

Highlight.js throwing `global is not defined` error via `core.js`

Open
#1,045 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10.2k
Forks
700
PR merge metrics
No merged PRs in 30d

Description

### Describe Your Environment

What version of Spectacle are you using? 8.3.0
What version of React are you using? 17.0.13
What browser are you using? Chrome (up to date)
What machine are you on? Mac

### Describe the Problem

I'm trying to bundle a set of similar slide decks for the web using Vite (for guests to visit later, to download references, etc). But I've hit the following error:

```
core.js:221 Uncaught ReferenceError: global is not defined
at capture (core.js:221)
at node_modules/refractor/core.js (core.js:5)
at __require (chunk-4YJPEX7N.js?v=66018443:9)
at hljs.js:891
```

As you can see, it's core.js, called via highlight.js. If you run the app without importing spectacle (e.g. plain react), it works fine.

Here's the test repo:
https://github.com/mikestopcontinues/slides

**Expected behavior:** I should work.
**Actual behavior:** It doesn't work. ;)

### Additional Information

Because syntax highlighting takes up so much darn space in the repo, I think it should be offered as a separate install anyway.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.