question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to deploy: Reference error self is not defined

See original GitHub issue

šŸ› Bug Report

I get a ReferenceError in Webpack while running yarn build to deploy the Hermes website.

I think it’s due to monaco-editor-webpack-plugin but I’m not sure.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

Note: I setup a branch that has the required hermes.js files we’re only adding to the gh-pages branch during deploys.

Expected behavior

  • Build completes, site deploys

Actual Behavior

Screen Shot 2020-04-01 at 12 53 56 PM

Your Environment

  • Docusaurus version used: 2.0.0-alpha.43
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node 12.9.1
  • Operating system and version (desktop or mobile): macOS

Reproducible Demo

https://github.com/rickhanlonii/hermes/tree/rh-deploy-hermes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
jonnynaborscommented, Apr 30, 2020

I have a similar issue when importing the Redoc React Component (https://github.com/Redocly/redoc#usage-as-a-react-component). The error only occurs when I’m actually importing the component.

My workaround was

let RedocStandalone = () => <div></div>;
if (ExecutionEnvironment.canUseDOM) {
  RedocStandalone = require('redoc').RedocStandalone;
}

That said, is there any way to bypass or disable the SSR bundle? That may not be the right way to ask that question, but I just want a client bundle that I can deploy.

2reactions
dotansimhacommented, Apr 23, 2020

@mharsat It’s usually happen because of SSR related issues. You can bypass that by loading those only for client side.

I did something like that: https://github.com/dotansimha/graphql-code-generator/blob/master/website/src/components/live-demo/Editor.js#L1-L4

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Why am I getting ReferenceError: self is not defined ...
The error occurs because the library requires Web APIs to work, which are not available when Next.js pre-renders the page on the server-sideĀ ......
Read more >
middlewares - ReferenceError: self is not defined Ā· Issue #38149
I'm experiencing the same issue. Upgraded to Next.js v12.2 and migrated the middleware accordingly. But builds are breaking with the exact sameĀ ...
Read more >
ReferenceError: self is not defined - Blockcerts Forum
This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it...
Read more >
node-self - npm
Even with undeclared identifiers, it will return 'undefined' instead of throwing an error. undeclared; // ReferenceError: undeclared is not ...
Read more >
self is not defined nextjs | The AI Search Engine You Control
Why am I getting ReferenceError: self is not defined when I import a client-side library? ... The error occurs because the library requires...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found