-
-
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 #3924
fix/umd-build #3924
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,39 +37,39 @@ export default function rollup(options: RollupOptions): RollupOptions[] { | |
name: 'query-core', | ||
packageDir: 'packages/query-core', | ||
jsName: 'QueryCore', | ||
outputFile: 'query-core', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: {}, | ||
}), | ||
...buildConfigs({ | ||
name: 'query-async-storage-persister', | ||
packageDir: 'packages/query-async-storage-persister', | ||
jsName: 'QueryAsyncStoragePersister', | ||
outputFile: 'query-async-storage-persister', | ||
outputFile: 'index', | ||
TkDodo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
entryFile: 'src/index.ts', | ||
globals: {}, | ||
}), | ||
...buildConfigs({ | ||
name: 'query-broadcast-client-experimental', | ||
packageDir: 'packages/query-broadcast-client-experimental', | ||
jsName: 'QueryBroadcastClient', | ||
outputFile: 'query-broadcast-client-experimental', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: {}, | ||
}), | ||
...buildConfigs({ | ||
name: 'query-sync-storage-persister', | ||
packageDir: 'packages/query-sync-storage-persister', | ||
jsName: 'QuerySyncStoragePersister', | ||
outputFile: 'query-sync-storage-persister', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: {}, | ||
}), | ||
...buildConfigs({ | ||
name: 'react-query', | ||
packageDir: 'packages/react-query', | ||
jsName: 'ReactQuery', | ||
outputFile: 'react-query', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: { | ||
react: 'React', | ||
|
@@ -79,7 +79,7 @@ export default function rollup(options: RollupOptions): RollupOptions[] { | |
name: 'react-query-devtools', | ||
packageDir: 'packages/react-query-devtools', | ||
jsName: 'ReactQueryDevtools', | ||
outputFile: 'react-query-devtools', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: { | ||
react: 'React', | ||
|
@@ -90,7 +90,7 @@ export default function rollup(options: RollupOptions): RollupOptions[] { | |
name: 'react-query-devtools-noop', | ||
packageDir: 'packages/react-query-devtools', | ||
jsName: 'ReactQueryDevtools', | ||
outputFile: 'react-query-devtools', | ||
outputFile: 'noop', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting this to |
||
entryFile: 'src/noop.ts', | ||
globals: { | ||
react: 'React', | ||
|
@@ -101,7 +101,7 @@ export default function rollup(options: RollupOptions): RollupOptions[] { | |
name: 'react-query-persist-client', | ||
packageDir: 'packages/react-query-persist-client', | ||
jsName: 'ReactQueryPersistClient', | ||
outputFile: 'react-query-persist-client', | ||
outputFile: 'index', | ||
entryFile: 'src/index.ts', | ||
globals: { | ||
react: 'React', | ||
|
@@ -194,7 +194,7 @@ function umdDev({ | |
output: { | ||
format: 'umd', | ||
sourcemap: true, | ||
file: `${packageDir}/build/umd/index.development.js`, | ||
file: `${packageDir}/build/umd/${outputFile}.development.js`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since all UMD builds were generating an output file with the |
||
name: jsName, | ||
globals, | ||
banner, | ||
|
@@ -224,7 +224,7 @@ function umdProd({ | |
output: { | ||
format: 'umd', | ||
sourcemap: true, | ||
file: `${packageDir}/build/umd/index.production.js`, | ||
file: `${packageDir}/build/umd/${outputFile}.production.js`, | ||
name: jsName, | ||
globals, | ||
banner, | ||
|
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.
Since the CJS and ESM production build entrypoints are noop's, I updated this to also follow that pattern
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 now have
index.development.js
,index.production.js
,noop.developtment.js
andnoop.production.js
produced. I don't think that's on purpose?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.
My thought was that
build/umd/index.development.js
would be distributed via CDN (to support use-cases like #3916).I'm not entirely sure what we want to do about the
"browser"
field here. It seems that the convention for CJS and ESM production builds is to resolve to a noop for the dev tools package? The counter-point to this would be supporting bundlers like Webpack 4, which might not know about the"exports"
field and instead use the"browser"
field. When I tried to use the dev tools package on a project that used an older version of Webpack, I ran into that problem and couldn't use the dev tools.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.
yeah me to (react-scripts v3). would be good if we could support this
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.
I tested the change from d85684b with
react-scripts
v3 and v4. Both versions are able to load@tanstack/react-query-devtools
properly with that change