Skip to content

Tree-Shaking & Bundle Optimization

The package declares "sideEffects": false and ships one module per source file, so a bundler can drop everything you do not import. This matters most for browser and Forge bundles.

The cost of a factory

createCloudClient is convenient and expensive: it wires up every endpoint on the platform surface, so importing it pulls all of them in. For a bundle that calls three endpoints, compose the client yourself from the flat functions instead:

typescript
import { createClient } from 'jira.js/core';
import { getIssue, createIssue } from 'jira.js/cloud';

const client = createClient({
  host: 'https://your-domain.atlassian.net',
  auth: { type: 'basic', email, apiToken },
});

const issue = await getIssue(client, { issueIdOrKey: 'TEST-1' });

Every function takes the client as its first argument. That is the same client the factories build, so the two styles mix freely — use the factory in a server where size does not matter, and the flat functions where it does.

Subpaths

ImportContents
jira.jsThe nine factories, the error types and their predicates, the OAuth helpers
jira.js/corecreateClient, the transport, errors, OAuth, multipart helpers
jira.js/cloudPlatform API functions and response types
jira.js/cloud/modelsPlatform API response types on their own
jira.js/cloud/parametersPlatform API request parameter types
jira.js/agileAgile API functions and response types
jira.js/agile/modelsAgile API response types on their own
jira.js/agile/parametersAgile API request parameter types
jira.js/serviceDeskService Management functions and response types
jira.js/serviceDesk/modelsService Management response types on their own
jira.js/serviceDesk/parametersService Management request parameter types
jira.js/serverData Center functions and response types
jira.js/server/modelsData Center response types on their own
jira.js/server/parametersData Center request parameter types
jira.js/assetsAssets Cloud functions and response types
jira.js/assets/modelsAssets Cloud response types on their own
jira.js/assets/parametersAssets Cloud request parameter types
jira.js/teamsTeams functions and response types
jira.js/teams/modelsTeams response types on their own
jira.js/teams/parametersTeams request parameter types
jira.js/adminOrganization API functions and response types
jira.js/admin/modelsOrganization API response types on their own
jira.js/admin/parametersOrganization API request parameter types
jira.js/userManagementUser management functions and response types
jira.js/userManagement/modelsUser management response types on their own
jira.js/userManagement/parametersUser management request parameter types
jira.js/userProvisioningSCIM provisioning functions and response types
jira.js/userProvisioning/modelsSCIM provisioning response types on their own
jira.js/userProvisioning/parametersSCIM provisioning request parameter types
jira.js/webhooksThe events, payloads and headers Jira posts to you, and the signature check
jira.js/browserPrebuilt browser bundle

The surface subpaths carry the response types alongside the functions, so a type-only import costs nothing at runtime. Request parameter types sit one level down, because a parameter and a model occasionally share a name:

typescript
import type { Issue } from 'jira.js/cloud';
import type { GetIssue } from 'jira.js/cloud/parameters';

The nine surfaces are not re-exported from the root, because they collide on a handful of names — import from the surface you mean.

Deep imports need an exports-aware resolver: moduleResolution: "bundler", "node16" or "nodenext". The legacy "node" resolution cannot see them, and cannot load an ESM-only package either.

What actually shrinks

Schemas are the bulk of the package: each response type carries the Zod schema it is validated against. Importing one endpoint pulls in its schema and the models that schema references, and nothing else — so the saving from the flat style is roughly proportional to how much of the API you leave out.