-
Notifications
You must be signed in to change notification settings - Fork 31
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 58a780e:
|
size-limit report 📦
|
{ | ||
"name": "createApi + setupListeners", | ||
"path": "dist/esm/index.js", | ||
"import": "{ createApi, setupListeners }" |
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.
Oh wow, I had no idea this was a thing! That's really cool!
Can we set this up for RTK too?
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 will, as soon as I recreate the changes I did here over there ;)
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { node: true, browsers: ['defaults', 'not IE 11', 'maintained node versions'] }, |
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.
So this now has two builds: an ESM build that does not bundle up the transpiled files, so just a file-for-file transpilation. This should help modern bundlers with tree-shaking quite a lot.
The target I chose for that is "all non-dead browsers, last 2 versions, no IE, maintained node versions".
The CJS build includes IE as well and builds only one file.
Do you think that's sensible @markerikson ?
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.
For reference: including IE there bumps the bundle sizes for the ESM module up to
ESM full
Size limit: 15 KB
Size: 13.8 KB with all dependencies, minified and gzipped
createApi + setupListeners
Size: 12.55 KB with all dependencies, minified and gzipped
fetchBaseQuery
Size: 3.23 KB with all dependencies, minified and gzipped
retry
Size: 2.79 KB with all dependencies, minified and gzipped
ApiProvider
Size: 387 B with all dependencies, minified and gzipped
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.
Sure, fine by me.
rollup.config.js
Outdated
@@ -74,6 +75,11 @@ const configs = [ | |||
? defaultTsConfig | |||
: { ...defaultTsConfig, declarationDir: 'dist/ts', declaration: true, declarationMap: true } | |||
), | |||
replace({ | |||
values: { | |||
'process.env.NODE_ENV': JSON.stringify(minfied ? 'production' : '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.
typo here? minfied
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.
yah, but just a variable name, will work either way 🤣
a5281ea
to
f12b58c
Compare
I guess letting this sit around any longer won't do any good -merging it in :) |
Putting this up here to see if CSB & co work. Still got some work to do.