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

There's an error about polyfills when starting a project (create-react-app@5) #252

Open
starikovs opened this issue Feb 8, 2024 · 0 comments

Comments

@starikovs
Copy link

I create a new project with npx create-react-app my-app, then I install npm i @stoplight/json-schema-viewer, and use it in the App.js providing a valid json schema:

import { JsonSchemaViewer } from "@stoplight/json-schema-viewer";

<JsonSchemaViewer
  name="Todos Model"
  schema={schema}
  expanded={true}
  hideTopBar={false}
  emptyText="No schema defined"
  defaultExpandedDepth={0}
/>; 

When I run npm start to start the project, I get such errors:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
	- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "buffer": false }

Maybe I'm doing something wrong, but maybe there's a bug.

Context

Cannot use the library.

Current Behavior

An error about polyfills when npm start.

Expected Behavior

I guess there shouldn't be an error when starting a project.

Possible Workaround/Solution

Steps to Reproduce

In the description.

Environment

  • Newest create-react-app (5)
  • Node v20.10.0
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

1 participant