-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Try to build bundles for RTK Query (core and React) #1011
Try to build bundles for RTK Query (core and React) #1011
Conversation
a51075e
to
9f4c289
Compare
- Dropped combined typedefs file - Switched to calling API Extractor inside the build script - Switched to running TSC once, first, for all source - Fixed output of index.js files for CJS
Good news, bad news. Good news:
Bad news:
Here's what I've got right now: "main": "dist/index.js",
"module": "dist/redux-toolkit.esm.js",
"unpkg": "dist/redux-toolkit.umd.min.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/redux-toolkit.esm.js",
"default": "./dist/index.js"
},
"./query": {
"types": "./dist/query/index.d.ts",
"module": "./dist/query/rtk-query.esm.js",
"default": "./dist/query/index.js"
},
"./query/react": {
"types": "./dist/query/react.d.ts",
"module": "./dist/query/react/rtk-query-react.esm.js",
"default": "./dist/query/react/index.js"
}
},
"typesVersions": {
"*": {
"query": ["./dist/query/index.d.ts"],
"query/react": ["./dist/query/react.d.ts"]
}
}, When I try to start up this CRA app, the result is:
Ditto if I try from I've dug through a dozen issues in random repos regarding export maps, and thus far I don't think I have any real idea what I'm doing. Ultimately, what I want is: // Standard entry point
import { createSlice } from "@reduxjs/toolkit";
// Nested entry point, still UI-agnostic APIs
import { createApi as genericCreateApi } from "@reduxjs/toolkit/query"
// Double-nested entry point, React-specific version of createApi
import { createApi as reactCreateApi} from "@reduxjs/toolkit/query/react" Really going to need some advice from experts on this one. |
Size Change: +467 B (0%) Total Size: 84.4 kB
ℹ️ View Unchanged
|
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 00440b1:
|
Per guidance from @Andarist , the problem was that Webpack 4 doesn't yet recognize export maps, so your package output has to have a folder structure that matches the intended import paths: https://twitter.com/AndaristRake/status/1385120048818364419 I moved the legacy RTKQ repo folder from I've re-enabled the CI checks I'd disabled and I'm going to go ahead and merge this. We don't have tests for the RTKQ code working yet, but that may be the biggest piece we're missing. |
VERY BUNDLED MUCH EXCITEMENT MAY MERGE NOW
I've managed to coerce the
build.ts
script into outputting the same bundle sets for the/query
and/query/react
dist folders. Notes so far:package.json
files for those entry points in the output, and they probably need to have proper keys for the bundle files (module
,main
, etc)tsc
againstsrc/query/tsconfig.json
produces a copy of the RTK.d.ts
files in a weird nested structure. Do we just need to run it once onsrc
? Was thinking I maybe needed to runtsc
programmatically for each one, but maybe not.--local
and--skipExtraction
args tobuild.ts
import('some-lib').SomeType
, per @phryneas's comment at [api-extractor] import() types are not handled correctly in .d.ts rollups microsoft/rushstack#1050 (comment)