From f12b58c9a0d3cec64b7108f0048b4cde20ce84d0 Mon Sep 17 00:00:00 2001 From: Lenz Weber Date: Thu, 17 Dec 2020 23:17:02 +0100 Subject: [PATCH] fixup after rebase --- package.json | 5 +++++ rollup.config.js | 2 +- src/core/module.ts | 3 +-- src/createApi.ts | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4b3e03e7..8b35f74a 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,11 @@ "path": "dist/esm/index.js", "limit": "15 KB" }, + { + "name": "createPureApi + setupListeners", + "path": "dist/esm/index.js", + "import": "{ createPureApi, setupListeners }" + }, { "name": "createApi + setupListeners", "path": "dist/esm/index.js", diff --git a/rollup.config.js b/rollup.config.js index 7f3585cf..a9253b07 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,7 +6,7 @@ import replace from '@rollup/plugin-replace'; /** @type {import("rollup").RollupOptions} */ const defaultConfig = { input: 'src/index.ts', - external: [/@babel\/runtime/, /@reduxjs\/toolkit/, /react/, /react-redux/, /immer/, /tslib/], + external: [/@babel\/runtime/, /@reduxjs\/toolkit/, /react$/, /react-redux/, /immer/, /tslib/], treeshake: { propertyReadSideEffects: false, }, diff --git a/src/core/module.ts b/src/core/module.ts index bce6a02a..e9490519 100644 --- a/src/core/module.ts +++ b/src/core/module.ts @@ -22,7 +22,6 @@ import { buildMiddleware } from './buildMiddleware'; import { buildSelectors } from './buildSelectors'; import { buildInitiate } from './buildInitiate'; import { assertCast, Id, safeAssign } from '../tsHelpers'; -import { IS_DEV } from '../utils'; import { InternalSerializeQueryArgs } from '../defaultSerializeQueryArgs'; import { SliceActions } from './buildSlice'; import { BaseQueryFn } from '../baseQueryTypes'; @@ -114,7 +113,7 @@ export const coreModule: Module = { assertCast>(serializeQueryArgs); const assertEntityType: AssertEntityTypes = (entity) => { - if (IS_DEV()) { + if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') { if (!entityTypes.includes(entity.type as any)) { console.error(`Entity type '${entity.type}' was used, but not specified in \`entityTypes\`!`); } diff --git a/src/createApi.ts b/src/createApi.ts index 19e77043..4b916151 100644 --- a/src/createApi.ts +++ b/src/createApi.ts @@ -2,7 +2,6 @@ import type { Api, Module, ModuleName } from './apiTypes'; import type { BaseQueryArg, BaseQueryFn } from './baseQueryTypes'; import { defaultSerializeQueryArgs, SerializeQueryArgs } from './defaultSerializeQueryArgs'; import { DefinitionType, EndpointBuilder, EndpointDefinitions } from './endpointDefinitions'; -import { IS_DEV } from './utils'; export interface CreateApiOptions< BaseQuery extends BaseQueryFn, @@ -62,7 +61,7 @@ export function buildCreateApi, ...Module[]]>( }); for (const [endpoint, definition] of Object.entries(evaluatedEndpoints)) { - if (IS_DEV()) { + if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') { if (!inject.overrideExisting && endpoint in context.endpointDefinitions) { console.error( `called \`injectEndpoints\` to override already-existing endpoint ${endpoint} without specifying \`overrideExisting: true\``