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
3 changes: 1 addition & 2 deletions packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
15 changes: 7 additions & 8 deletions packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/lib/index.js",
"types": "build/lib/index.d.ts",
"files": [
"build/lib/*",
"build/umd/*",
"cjs.fallback.js",
"src"
],
"exports": {
".": {
"development": {
Expand All @@ -40,6 +33,12 @@
},
"./package.json": "./package.json"
},
"files": [
"build/lib/*",
"build/umd/*",
"cjs.fallback.js",
"src"
],
"scripts": {
"clean": "rm -rf ./build",
"test:eslint": "../../node_modules/.bin/eslint --ext .ts,.tsx ./src"
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"types": "build/lib/index.d.ts",
"module": "build/lib/index.mjs",
"main": "build/lib/index.js",
"browser": "build/umd/index.production.js",
"types": "build/lib/index.d.ts",
"exports": {
".": {
"types": "./build/lib/index.d.ts",
Expand Down
11 changes: 10 additions & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ export default function rollup(options: RollupOptions): RollupOptions[] {
entryFile: 'src/index.ts',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'@tanstack/query-core': 'QueryCore',
},
bundleUMDGlobals: ['@tanstack/query-core'],
}),
...buildConfigs({
name: 'react-query-devtools',
Expand Down Expand Up @@ -128,10 +130,17 @@ function buildConfigs(opts: {
outputFile: string
entryFile: string
globals: Record<string, string>
// This option allows to bundle specified dependencies for umd build
bundleUMDGlobals?: string[]
}): RollupOptions[] {
const input = path.resolve(opts.packageDir, opts.entryFile)
const externalDeps = Object.keys(opts.globals)

const bundleUMDGlobals = opts.bundleUMDGlobals || []
const umdExternal = externalDeps.filter(
(external) => !bundleUMDGlobals.includes(external),
)

const external = (moduleName) => externalDeps.includes(moduleName)
const banner = createBanner(opts.name)

Expand All @@ -145,7 +154,7 @@ function buildConfigs(opts: {
globals: opts.globals,
}

return [esm(options), cjs(options), umdDev(options), umdProd(options)]
return [esm(options), cjs(options), umdDev({...options, external: umdExternal}), umdProd({...options, external: umdExternal})]
}

function esm({ input, packageDir, external, banner }: Options): RollupOptions {
Expand Down