-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix: umd build size, force prod devtools #4074
fix: umd build size, force prod devtools #4074
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ed141c9:
|
c4728ab
to
ed141c9
Compare
@@ -14,7 +14,8 @@ | |||
"test:jest": "lerna run test:codemods --stream --no-bail && jest --config ./jest.config.ts", | |||
"test:jest:dev": "jest --config ./jest.config.ts --watch", | |||
"test:size": "npm run build && bundlewatch", | |||
"build": "rollup --config rollup.config.js && npm run typecheck", | |||
"build": "rollup --config rollup.config.js && npm run typecheck && npm run build:copyTypes", | |||
"build:copyTypes": "cp packages/react-query-devtools/build/lib/index.d.ts packages/react-query-devtools/build/lib/index.prod.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed due to a bug in typescript which supposed to support exports
, but actually does not map to a proper file.
"types": "./build/lib/index.d.ts", | ||
"import": "./build/lib/index.mjs", | ||
"default": "./build/lib/index.js" | ||
}, | ||
"./build/lib/index.prod.js": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This export is needed for modern bundlers to force prod devtools.
index.prod.js
is build replacing NODE_ENV
with development
in result dropping if
conditions from source code.
@@ -14,37 +14,32 @@ | |||
"main": "build/lib/index.js", | |||
"exports": { | |||
".": { | |||
"development": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generated files index.js
/index.mjs
still contain NODE_ENV
conditions which will be used by the bundler to treeshake it from production
}), | ||
...buildConfigs({ | ||
name: 'react-query-devtools-noop', | ||
name: 'react-query-devtools-prod', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config was changed to contain non-treeshakable devtools build accessible via @tanstack/react-query-devtools/build/lib/index.prod.js
}, | ||
forceDevEnv: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forces the build to thinks it's bundling for dev env
}, | ||
forceDevEnv: true, | ||
skipUmdBuild: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not want to generate extra set for umd
, since those are already generated
@TkDodo So this seems to be working for The only issue i can see is that |
@DamianOsipiuk okay, let's make a new beta and I'll try it out! |
* fix: restore missing `exports` declarations (#3892) * fix: restore missing `exports` declarations * fix: restore package.json exports[C * fix: reexport types used by vue-query * fix: react-native uSES usage * fix: emit mjs for esm * fix: uSES build * fix: devtools exports to allow devtools in prod * fix: cjs and esm build bundled to lib dir * fix: sideEffect in react-query, better files paths * fix: generate declarations to lib * fix: lint and tests * fix: use the same ts build method for tests * fix: change force prod import * fix: subpackage dependencies (#4013) * fix: umd-build (#3924) * - Fix UMD build getting overwritten - Updating "browser" field for @tanstack/react-query-devtools * Updating the "browser" field to be the same as "main" * release: v4.0.11-beta.0 * release: v4.0.11-beta.1 * fix(react-query-devtools): cjs devtools fallback (#4048) * release: v4.0.11-beta.2 * fix: remove browser entry, fix umd size (#4044) * fix: remove browser entry, fix umd size * fix: bundle query-core with react-query for umd * fix: remove missed browser entry * chore: remove 'browser' field from package validation because it doesn't exist anymore * release: v4.0.11-beta.3 * release: v4.0.11-beta.4 * chore: react-query should be a peerDependency of the devtools * release: v4.0.11-beta.5 * release: v4.3.0-beta.0 * fix: webpack 4 fallback to cjs (#4069) * fix: publish script shouldn't check against module anymore * fix: publish script I don't think we can have single quotes in commit message when passing them to --notes * release: v4.3.0-beta.2 * release: v4.3.0-beta.3 * fix: umd build size, force prod devtools (#4074) * fix: umd build size * fix: devtools force production * release: v4.3.0-beta.4 * release: v4.3.0-beta.5 * fix: reintroduce production export (#4090) * release: v4.3.0-beta.6 * fix(react-query-devtools): always useEffect for the mounted check no effect runs on the server, and there is no real advantage to useLayoutEffect on the client; somehow, this dynamic check creates problems with the production build of the devtools * release: v4.3.0-beta.7 * docs: document devtools in production * docs: document devtools in production * docs: document devtools in production nodenext needs 4.7 * fix: support react-native (#4125) * fix: support react-native * chore: remove banner from build Co-authored-by: Damian Osipiuk <[email protected]> Co-authored-by: John Daly <[email protected]> Co-authored-by: Tanner Linsley <[email protected]>
No description provided.