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
I create a new project with
npx create-react-app my-app, then I installnpm i @stoplight/json-schema-viewer, and use it in theApp.jsproviding a valid jsonschema:When I run
npm startto start the project, I get such errors: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
create-react-app(5)