Skip to content

Commit c412df0

Browse files
committed
fix(react-query-devtools): only export devtools in development mode
finally
1 parent df9c197 commit c412df0

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"test:jest:dev": "jest --config ./jest.config.ts --watch",
1616
"test:size": "npm run build && bundlewatch",
1717
"build": "rollup --config rollup.config.js && npm run typecheck",
18+
"postbuild": "cp ./packages/react-query-devtools/src/noop.ts ./packages/react-query-devtools/build/esm/noop.js",
1819
"typecheck": "tsc -b",
1920
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"npm run typecheck -- --watch\" \"npm run test\"",
2021
"linkAll": "lerna exec 'npm run link' --parallel",

packages/react-query-devtools/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@
1010
"type": "github",
1111
"url": "https://github.com/sponsors/tannerlinsley"
1212
},
13+
"module": "build/esm/index.js",
1314
"main": "build/cjs/packages/react-query-devtools/src/index.js",
1415
"browser": "build/umd/index.production.js",
1516
"types": "build/types/react-query-devtools/src/index.d.ts",
1617
"files": [
1718
"build/*",
1819
"src"
1920
],
21+
"exports": {
22+
"development": {
23+
"default": "./build/esm/index.js"
24+
},
25+
"default": "./build/esm/noop.js"
26+
},
2027
"scripts": {
2128
"test:eslint": "../../node_modules/.bin/eslint --ext .ts,.tsx ./src",
2229
"compile": "../../node_modules/.bin/tsc -p tsconfig.json --noEmit --emitDeclarationOnly false"
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
if (process.env.NODE_ENV !== 'development') {
2-
module.exports = {
3-
ReactQueryDevtools: function () {
4-
return null
5-
},
6-
ReactQueryDevtoolsPanel: function () {
7-
return null
8-
},
9-
}
10-
} else {
11-
module.exports = require('./devtools')
12-
}
1+
export * from './devtools'

0 commit comments

Comments
 (0)