-
Notifications
You must be signed in to change notification settings - Fork 416
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
Error when incorporating web-vitals into a Electron x React application: chunk runtime-main [entry] Cannot convert undefined or null to object #146
Comments
Hmmm, I tried following these steps and did not get any build errors. This is what I see: myapp git:(main) ✗ npm run build
> myapp@0.1.0 build /Users/philipwalton/Projects/philipwalton/electron/myapp
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
41.33 KB build/static/js/2.7d671bad.chunk.js
1.56 KB build/static/js/3.6eec110b.chunk.js
1.16 KB build/static/js/runtime-main.2bdb99f6.js
595 B (+7 B) build/static/js/main.53b51097.chunk.js
574 B build/static/css/main.9d5b29c0.chunk.css
The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
https://cra.link/deployment Can you check to see if a step is missing from your build instructions? |
Hi, @philipwalton, Here's a sample application showing this error: https://github.com/mongomoe/Sample-React-Electron-Web-Vitals-App You can clone it, cd into it, npm install, and then run 'npm run build' to see the error. |
I've updated the issue description to make the steps a bit more clear. |
Hmmm, ok thanks, I can reproduce the error now. But unfortunately the I'm not familiar with create-react-app or craco, but if you're able to debug and at least get a stack trace, then I can see if there's a workaround I can add so the library works in this environment. My (possibly wrong) guess as to what's going on is that the Electron runtime doesn't support some API that the library is assuming is available (since it's built to run in the browser). |
Hi, I'm building an application that uses create-react-app with Electron. Version 4.x of Create React App includes web-vitals (whereas earlier versions of create-react-app, such as 3.4.x, did not include web-vitals). Since web-vitals has been added I cannot build my application, unless I manually remove 'web-vitals' since I get the following error when trying to bundle the application with webpack: chunk runtime-main [entry] Cannot convert undefined or null to object
Steps to reproduce:
Step 1: Create your app
Step 2: Install Dependencies:
Step 3: Create a build script
Step 4: Load your build/index.html into an Electron Window
Step 5: Update your package.json:
Upon running 'npm run build', you get the error "chunk runtime-main [entry] Cannot convert undefined or null to object"
However, if you npm uninstall 'web-vitals' from the project, the error goes away.
The text was updated successfully, but these errors were encountered: