diff --git a/.github/workflows/size.yml b/.github/workflows/size.yml index a6641244ad..cbd9afb73d 100644 --- a/.github/workflows/size.yml +++ b/.github/workflows/size.yml @@ -18,3 +18,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} build_script: build-only package_manager: yarn + size_margin: non-zero diff --git a/packages/toolkit/.size-limit.cjs b/packages/toolkit/.size-limit.cjs index 6d32250744..a6999b566b 100644 --- a/packages/toolkit/.size-limit.cjs +++ b/packages/toolkit/.size-limit.cjs @@ -1,8 +1,8 @@ const webpack = require('webpack') let { join } = require('path') -const esmSuffixes = ['modern.mjs', 'browser.mjs', 'legacy-esm.js'] -const cjsSuffixes = ['development.cjs', 'production.min.cjs'] +const esmSuffixes = ['modern.mjs' /*, 'browser.mjs', 'legacy-esm.js'*/] +const cjsSuffixes = [/*'development.cjs',*/ 'production.min.cjs'] function withRtkPath(suffix, cjs = false) { /** @@ -149,11 +149,21 @@ module.exports = entryPoints ), ) .concat( - ...[ + [ { name: `3. createSlice`, import: { '@reduxjs/toolkit': '{ createSlice }' }, }, + { + name: `3. createAsyncThunk`, + import: { '@reduxjs/toolkit': '{ createAsyncThunk }' }, + }, + { + name: `3. buildCreateSlice and asyncThunkCreator`, + import: { + '@reduxjs/toolkit': '{ buildCreateSlice, asyncThunkCreator }', + }, + }, { name: `3. createEntityAdapter`, import: { '@reduxjs/toolkit': '{ createEntityAdapter }' }, @@ -162,6 +172,22 @@ module.exports = entryPoints name: `3. configureStore`, import: { '@reduxjs/toolkit': '{ configureStore }' }, }, + { + name: `3. combineSlices`, + import: { '@reduxjs/toolkit': '{ combineSlices }' }, + }, + { + name: `3. createDynamicMiddleware`, + import: { '@reduxjs/toolkit': '{ createDynamicMiddleware }' }, + }, + { + name: `3. createDynamicMiddleware (react)`, + import: { '@reduxjs/toolkit/react': '{ createDynamicMiddleware }' }, + }, + { + name: `3. createListenerMiddleware`, + import: { '@reduxjs/toolkit': '{ createListenerMiddleware }' }, + }, { name: `3. createApi`, import: { '@reduxjs/toolkit/query': '{ createApi }' }, @@ -174,14 +200,6 @@ module.exports = entryPoints name: `3. fetchBaseQuery`, import: { '@reduxjs/toolkit/query': '{ fetchBaseQuery }' }, }, - { - name: `3. setupListeners`, - import: { '@reduxjs/toolkit/query': '{ setupListeners }' }, - }, - { - name: `3. ApiProvider`, - import: { '@reduxjs/toolkit/query/react': '{ ApiProvider }' }, - }, ].map((e) => ({ ...e, name: e.name + ` (.modern.mjs)`, diff --git a/packages/toolkit/src/createSlice.ts b/packages/toolkit/src/createSlice.ts index 441fbbcc6a..6158920af8 100644 --- a/packages/toolkit/src/createSlice.ts +++ b/packages/toolkit/src/createSlice.ts @@ -28,7 +28,9 @@ import type { import { createAsyncThunk as _createAsyncThunk } from './createAsyncThunk' import { emplace } from './utils' -const asyncThunkSymbol = Symbol.for('rtk-slice-createasyncthunk') +const asyncThunkSymbol = /* @__PURE__ */ Symbol.for( + 'rtk-slice-createasyncthunk', +) // type is annotated because it's too long to infer export const asyncThunkCreator: { [asyncThunkSymbol]: typeof _createAsyncThunk @@ -863,7 +865,7 @@ function wrapSelector>( * * @public */ -export const createSlice = buildCreateSlice() +export const createSlice = /* @__PURE__ */ buildCreateSlice() interface ReducerHandlingContext { sliceCaseReducersByName: Record<