Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build with react-snapshot anymore. /build/ doesn't generate .html #124

Open
SergiuHKR opened this issue May 14, 2019 · 4 comments
Open

Comments

@SergiuHKR
Copy link

Beginner here. My React app used to build correctly, however...

"npm run build" is no longer building any .html files in my /build/

Package.json

{
  "name": "hkrmedia",
  "version": "0.1.1",
  "private": true,
  "dependencies": {
    "firebase": "^6.0.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.0",
    "react-scripts": "^3.0.1",
    "react-snapshot": "^1.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && react-snapshot",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

After "npm run build" I get..

🕷   Starting crawling http://localhost:49689/
Error: Uncaught [ReferenceError: IDBIndex is not defined]
    at reportException (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:58:24)
    at processJavaScript (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:130:7)
    at HTMLScriptElementImpl._eval (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:65:7)
    at /Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:31:22
    at Object.check (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:89:11)
    at Object.check (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:92:23)
    at /Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/living/nodes/Document-impl.js:108:12
    at wrappedEnqueued (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:255:16)
    at Request.request [as _callback] (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/react-snapshot/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:203:9)
    at Request.self.callback (/Users/sergiupoenaru/dev/learn_react/hkrmedia/node_modules/request/request.js:185:22) ReferenceError: IDBIndex is not defined
    at http://localhost:49689/static/js/2.7c9ce00a.chunk.js:1:51740
    at Object.<anonymous> (http://localhost:49689/static/js/2.7c9ce00a.chunk.js:1:54131)
    at f (http://localhost:49689/:1:518)
    at Module.<anonymous> (http://localhost:49689/static/js/2.7c9ce00a.chunk.js:1:839784)
    at f (http://localhost:49689/:1:518)
    at Object.<anonymous> (http://localhost:49689/static/js/2.7c9ce00a.chunk.js:1:825886)
    at f (http://localhost:49689/:1:518)
    at Object.<anonymous> (http://localhost:49689/static/js/2.7c9ce00a.chunk.js:1:48569)
    at f (http://localhost:49689/:1:518)
    at Module.66 (http://localhost:49689/static/js/main.21fd7f07.chunk.js:1:1912)
🔥 **'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?**
🕸   Finished crawling.

My index.js is:

import React from 'react';
/*import ReactDOM from 'react-dom';*/
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { BrowserRouter } from 'react-router-dom';

import { render } from 'react-snapshot';

render((
  <BrowserRouter>
  <App />
  </BrowserRouter>
), document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
@Abubakr98
Copy link

Abubakr98 commented May 18, 2019

I have the same problem, anybody help?

@SergiuHKR
Copy link
Author

I have the same problem, anybody help?

I switched to react-snap meanwhile.

@Martin36
Copy link

Martin36 commented Feb 1, 2020

I get a similar error, but it points to a problem with that it can't find firebase:

Starting crawling http://localhost:49975/
Error: Uncaught [ReferenceError: firebase is not defined]
    at reportException (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:58:24)
    at processJavaScript (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:130:7)
    at HTMLScriptElementImpl._eval (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:65:7)
    at D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:31:22
    at Object.check (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:89:11)
    at D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:108:12
    at HTMLScriptElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:42:72)
    at HTMLBodyElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Node-impl.js:294:15)
    at HTMLBodyElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Element-impl.js:110:11)
    at HTMLHtmlElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Node-impl.js:294:15) ReferenceError: firebase is not defined
    at http://localhost:49975/:1:397
    at Script.runInContext (vm.js:107:20)
    at Object.runInContext (vm.js:285:6)
    at processJavaScript (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:128:10)
    at HTMLScriptElementImpl._eval (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:65:7)
    at D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:31:22
    at Object.check (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:89:11)
    at D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:108:12
    at HTMLScriptElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:42:72)
    at HTMLBodyElementImpl._attach (D:\Documents\Nutrient visualization\nutrient-visualizer\node_modules\jsdom\lib\jsdom\living\nodes\Node-impl.js:294:15)
🔥 'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?
🕸   Finished crawling.

@Abubakr98
Copy link

Just use react-snap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants