Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/react/guides/migrating-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ Custom loggers were already deprecated in 4 and have been removed in this versio

We have updated our browserslist to produce a more modern, performant and smaller bundle. You can read about the requirements [here](../installation#requirements).

### Supported Bundlers

We have removed the legacy `.esm.js` output, which was used by bundlers which didn't recognise the modern `.mjs` extension such as Webpack v4. If you are still using Webpack v4, you can continue to use TanStack Query v4, or upgrade to Webpack v5 or another bundler.

### Private class fields and methods

TanStack Query has always had private fields and methods on classes, but they weren't really private - they were just private in `TypeScript`. We now use [ECMAScript Private class features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields), which means those fields are now truly private and can't be accessed from the outside at runtime.
Expand Down
2 changes: 1 addition & 1 deletion packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
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 @@ -17,7 +17,7 @@
"type": "commonjs",
"types": "build/lib/index.d.ts",
"main": "build/lib/index.js",
"module": "build/lib/index.esm.js",
"module": "build/lib/index.mjs",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
38 changes: 1 addition & 37 deletions scripts/getRollupConfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function buildConfigs(opts) {
forceBundle: opts.forceBundle || false,
}

let builds = [mjs(options), esm(options), cjs(options)]
let builds = [mjs(options), cjs(options)]

if (!opts.skipUmdBuild) {
builds = builds.concat([
Expand Down Expand Up @@ -123,42 +123,6 @@ function mjs({ input, external, outputFile, forceDevEnv, forceBundle }) {
}
}

/**
* @param {import('./types').Options} options - Options for building configurations.
* @returns {import('rollup').RollupOptions}
*/
function esm({ input, external, outputFile, forceDevEnv, forceBundle }) {
/** @type {import('rollup').OutputOptions} */
const bundleOutput = {
format: 'esm',
file: `./build/lib/${outputFile}.esm.js`,
sourcemap: true,
}

/** @type {import('rollup').OutputOptions} */
const normalOutput = {
format: 'esm',
dir: `./build/lib`,
sourcemap: true,
preserveModules: true,
entryFileNames: '[name].esm.js',
}

return {
// ESM
external,
input,
output: forceBundle ? bundleOutput : normalOutput,
plugins: [
babelPlugin('legacy'),
commonJS(),
nodeResolve({ extensions: ['.ts', '.tsx', '.native.ts'] }),
forceDevEnv ? forceEnvPlugin('development') : undefined,
preserveDirectives(),
],
}
}

/**
* @param {import('./types').Options} options - Options for building configurations.
* @returns {import('rollup').RollupOptions}
Expand Down