snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
22
integrations/react-webpack-5/package.json
Normal file
22
integrations/react-webpack-5/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "react-webpack-5",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "webpack --mode production"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "workspace:*",
|
||||
"@tanstack/react-query-devtools": "workspace:*",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/preset-env": "^7.26.0",
|
||||
"@babel/preset-react": "^7.25.9",
|
||||
"babel-loader": "^9.2.1",
|
||||
"html-webpack-plugin": "^5.6.3",
|
||||
"webpack": "^5.96.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
}
|
||||
11
integrations/react-webpack-5/public/index.html
Normal file
11
integrations/react-webpack-5/public/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>react-webpack-5</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
24
integrations/react-webpack-5/src/App.js
vendored
Normal file
24
integrations/react-webpack-5/src/App.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
const App = () => {
|
||||
const query = useQuery({
|
||||
queryKey: ['test'],
|
||||
queryFn: async () => {
|
||||
await new Promise((r) => setTimeout(r, 1000))
|
||||
return 'Success'
|
||||
},
|
||||
})
|
||||
|
||||
if (query.isPending) {
|
||||
return <div>Loading...</div>
|
||||
}
|
||||
|
||||
if (query.isError) {
|
||||
return <div>An error has occurred!</div>
|
||||
}
|
||||
|
||||
return <div>{query.data}</div>
|
||||
}
|
||||
|
||||
export default App
|
||||
18
integrations/react-webpack-5/src/index.js
vendored
Normal file
18
integrations/react-webpack-5/src/index.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
||||
import App from './App'
|
||||
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'))
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App />
|
||||
<ReactQueryDevtools />
|
||||
</QueryClientProvider>
|
||||
</React.StrictMode>,
|
||||
)
|
||||
24
integrations/react-webpack-5/webpack.config.js
Normal file
24
integrations/react-webpack-5/webpack.config.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const HtmlWebPackPlugin = require('html-webpack-plugin')
|
||||
|
||||
const htmlPlugin = new HtmlWebPackPlugin({
|
||||
template: './public/index.html',
|
||||
filename: './index.html',
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(?:js|mjs|cjs|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env', '@babel/preset-react'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [htmlPlugin],
|
||||
}
|
||||
Reference in New Issue
Block a user