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

feat: Remove UMD build output #5517

Merged
merged 14 commits into from
Jun 2, 2023
Merged
16 changes: 9 additions & 7 deletions docs/react/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ id: installation
title: Installation
---

You can install React Query via [NPM](https://npmjs.com),
You can install React Query via [NPM](https://npmjs.com/),
or a good ol' `<script>` via
[unpkg.com](https://unpkg.com).
[ESM.sh](https://esm.sh/).

> v5 is currently in alpha.

Expand All @@ -25,15 +25,17 @@ React Query is compatible with React v18+ and works with ReactDOM and React Nati

### CDN

If you're not using a module bundler or package manager we also have a global ("UMD") build hosted on the [unpkg.com](https://unpkg.com) CDN. Simply add the following `<script>` tag to the bottom of your HTML file:
If you're not using a module bundler or package manager, you can also use this library via an ESM-compatible CDN such as [ESM.sh](https://esm.sh/). Simply add a `<script type="module">` tag to the bottom of your HTML file:

```html
<script src="https://unpkg.com/@tanstack/react-query@alpha/build/umd/index.production.js"></script>
<script type="module">
import React from 'https://esm.sh/[email protected]'
import ReactDOM from 'https://esm.sh/[email protected]'
import { QueryClient } from 'https://esm.sh/@tanstack/react-query@alpha'
</script>
```

Once you've added this you will have access to the `window.ReactQuery` object and its exports.

> This installation/usage requires the [React CDN script bundles](https://reactjs.org/docs/cdn-links.html) to be on the page as well.
> You can find instructions on how to use React without JSX [here](https://react.dev/reference/react/createElement#creating-an-element-without-jsx).

### Requirements

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@solidjs/testing-library": "^0.5.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
Expand Down Expand Up @@ -83,7 +82,6 @@
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
"rollup-plugin-preserve-directives": "^0.2.0",
"rollup-plugin-size": "^0.3.1",
"rollup-plugin-visualizer": "^5.9.0",
"rollup-preset-solid": "^2.0.1",
"semver": "^7.5.1",
Expand All @@ -97,7 +95,7 @@
"bundlewatch": {
"files": [
{
"path": "packages/*/build/umd/*.production.js"
"path": "packages/*/build/lib/*.js"
Copy link
Collaborator

@TkDodo TkDodo Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the report we're getting is that helpful now:

Screenshot 2023-06-05 at 09 22 19

from: https://cloud.nx.app/runs/llccfmKwnL

}
]
},
Expand Down
1 change: 0 additions & 1 deletion packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
},
"type": "commonjs",
"types": "build/types/index.d.ts",
"main": "build/umd/index.js",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
".": {
"types": "./build/types/index.d.ts",
"import": "./build/esm/index.mjs",
"require": "./build/umd/index.js",
"default": "./build/umd/index.js"
"require": "./build/cjs/index.js",
"default": "./build/cjs/index.js"
},
"./package.json": "./package.json"
},
Expand Down
1 change: 0 additions & 1 deletion packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
6 changes: 2 additions & 4 deletions packages/react-query-devtools/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from 'rollup'
import { buildConfigs } from '../../scripts/getRollupConfig.mjs'

export default defineConfig([
...buildConfigs({
buildConfigs({
name: 'react-query-devtools',
jsName: 'ReactQueryDevtools',
outputFile: 'index',
Expand All @@ -15,9 +15,8 @@ export default defineConfig([
'@tanstack/react-query': 'ReactQuery',
'@tanstack/query-devtools': 'TanstackQueryDevtools',
},
bundleUMDGlobals: ['@tanstack/query-devtools'],
}),
...buildConfigs({
buildConfigs({
name: 'react-query-devtools-prod',
jsName: 'ReactQueryDevtools',
outputFile: 'index.prod',
Expand All @@ -31,6 +30,5 @@ export default defineConfig([
},
forceDevEnv: true,
forceBundle: true,
skipUmdBuild: true,
}),
])
1 change: 0 additions & 1 deletion packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"sideEffects": false,
"files": [
"build/lib/*",
"build/umd/*",
"src"
],
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/react-query-persist-client/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ export default defineConfig(
'@tanstack/query-persist-client-core': 'QueryPersistClientCore',
'@tanstack/react-query': 'ReactQuery',
},
bundleUMDGlobals: ['@tanstack/query-persist-client-core'],
}),
)
1 change: 0 additions & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"files": [
"build/lib/*",
"build/umd/*",
"src",
"build/codemods",
"!build/codemods/jest.config.js",
Expand Down
1 change: 0 additions & 1 deletion packages/react-query/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export default defineConfig(
'@tanstack/query-core': 'QueryCore',
'react-native': 'ReactNative',
},
bundleUMDGlobals: ['@tanstack/query-core'],
}),
)
1 change: 0 additions & 1 deletion packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"files": [
"build/esm/*",
"build/cjs/*",
"build/umd/*",
"build/source/*",
"build/types/*",
"src"
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"files": [
"build/lib/*",
"build/umd/*"
"src"
],
"dependencies": {
"@tanstack/query-core": "^5.0.0-alpha.43",
Expand Down
5 changes: 0 additions & 5 deletions packages/vue-query/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,5 @@ export default defineConfig(
'@tanstack/match-sorter-utils': 'MatchSorter',
'@vue/devtools-api': 'DevtoolsApi',
},
bundleUMDGlobals: [
'@tanstack/query-core',
'@tanstack/match-sorter-utils',
'@vue/devtools-api',
],
}),
)
62 changes: 0 additions & 62 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading