-
Notifications
You must be signed in to change notification settings - Fork 9k
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
swagger-ui-react: Build broken with react-scripts 5.0.0 #7704
Comments
Any update or backup solution on this ? I have the same issue :( |
Any solution??- |
Webpack 5 not suuported Buffer
|
27 tasks
Any updates on this? When can it be merged? |
#7826 did not fix the build issue... |
@haavardw Can you paste the errors you're getting? |
Here's the commands I use to create a new project from scratch and the final error message $ nvm use 14
$ npx create-react-app my-app --template typescript
$ yarn add swagger-ui-react @types/swagger-ui-react
$ cat <<EOF > src/App.tsx
import React from 'react';
import './App.css';
import SwaggerUI from "swagger-ui-react";
import "swagger-ui-react/swagger-ui.css";
function App() {
return (
<SwaggerUI spec="" />
);
}
export default App;
EOF
$ yarn build Output yarn run v1.22.17
$ react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve 'buffer' in '/home/haavardw/tmp/my-app/node_modules/swagger-ui-react'
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 }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Opened new issue: #7893 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Build is broken with react-scripts 5.0.0 which has upgraded to webpack 5 which no longer includes polyfills for node.js, needed by the xml package used by swagger-ui-react.
To reproduce
Upgrade to react-scripts 5.0.0, e.g
yarn upgrade -L
.The text was updated successfully, but these errors were encountered: