Skip to content

Public API ​

ts
import shopify, { shopifyTheme } from '@display-studio/vite-plugin-shopify-theme';

The package exports only its root. The default export and shopifyTheme are identical; the default import is canonical. The vite-shopify-theme executable is not a JavaScript subpath API, and the package has zero runtime dependencies.

What is public ​

NameKindNotes
default export, shopifyThemefunctionThe Vite plugin.
ShopifyThemeOptionstypeThe plugin options; see Configuration.
EntryOptionstypeThe object form of an entry; see Entry options.
Diagnostic codesstringsThe [shopify-theme:CODE] prefix of every message; listed below.
vite-shopify-theme init and devCLITheir documented flags; see CLI init and Development modes.

A diagnostic code keeps its meaning within a major version. The text after the code is for people and can change in any release, so match on the code, not on the message.

Deprecated exports ​

These names are exported from the root by accident. They are internal, they are marked @deprecated in the types as of 0.7.0, and they are removed in 1.0.0. If you rely on one, open an issue describing the use before 1.0.0.

NameKind
normalizeOptionsfunction
NormalizedOptionstype
collectManifestTagsfunction
ManifestTagstype
developmentSnippetfunction
productionSnippetfunction, also out of date: it cannot render attributes, inline, or the CSS bundle

devOrigin is deprecated too and is removed in 1.0.0; see Live Theme Editor.

Diagnostic codes ​

Errors stop the build or the development server. Warnings let it continue.

CodeLevelMeaning
BUILD_CLEANUP_FAILEDerrorA build failed and releasing theme ownership failed as well.
BUILD_CSS_MISSINGerrorThe aggregated stylesheet that build.cssCodeSplit: false needs was not generated.
BUILD_ROLLBACK_FAILEDerrorA build failed and the previous snippet could not be restored.
CONFIG_CSS_ENTRY_RESERVEDerrorA non-stylesheet entry uses the name reserved for the aggregated stylesheet.
CONFIG_DEV_ORIGINerrordevOrigin is not an absolute HTTPS origin.
CONFIG_DIAGNOSTICSerrordiagnostics is not a boolean.
CONFIG_ENTRIESerrorAn entry is not a non-empty source path or a valid entry object.
CONFIG_SNIPPETerrorsnippet is not a path string relative to themeRoot.
CONFIG_THEME_ROOTerrorthemeRoot is not a path string.
CONFIG_VITE_CONFLICTerrorA Vite option the plugin owns, such as publicDir, is set in the user config.
DEV_EXTERNAL_ORIGINwarningdevOrigin is in use: the HTTPS tunnel must stay up and stable.
DEV_ORIGIN_DEPRECATEDwarningdevOrigin is deprecated; use dev --editor.
DEV_ORIGIN_UNAVAILABLEerrorThe development origin cannot be determined, for example in middleware mode.
DEV_OWNERSHIP_LOSTerrorTheme ownership was lost before the development server started.
FS_JSON_INVALIDerrorA JSON file the plugin reads is not valid JSON.
FS_READ_FAILEDerrorA file could not be read.
FS_REMOVE_FAILEDerrorA plugin-owned file could not be removed.
FS_WRITE_FAILEDerrorA generated file could not be written atomically.
INLINE_CSS_TOO_LARGEwarningAn inline stylesheet is over Shopify's 15 KB limit, so a normal <link> is rendered.
LOCK_ACQUIRE_FAILEDerrorTheme ownership could not be acquired after several attempts.
LOCK_ACTIVEerrorAnother live process owns the theme.
LOCK_CHANGEDerrorThe ownership lock changed unexpectedly.
LOCK_CREATE_FAILEDerrorThe ownership lock directory could not be created.
LOCK_METADATA_INVALIDerrorThe lock metadata could not be read or parsed.
LOCK_METADATA_MISSINGerrorThe lock directory has no metadata.
LOCK_RECLAIM_FAILEDerrorA stale lock could not be reclaimed.
LOCK_RELEASE_FAILEDerrorThe ownership lock could not be released.
MANIFEST_ENTRY_MISSINGerrorThe Vite manifest lacks a declared entry.
MANIFEST_IMPORT_MISSINGerrorA manifest entry imports a chunk that the manifest does not contain.
MANIFEST_INVALIDerrorThe Vite manifest is not a JSON object.
PATH_MISSINGerrorA required path does not exist.
PATH_OUTSIDE_THEMEerrorA path resolves outside the theme root.
PATH_RESOLUTION_FAILEDerrorA path could not be resolved.
SNIPPET_SIZE_NEAR_LIMITwarningThe generated snippet is close to Shopify's 256 kB limit.
STATE_INVALIDerrorThe ownership state file has an invalid structure.
THEME_STRUCTURE_INVALIDerrorThe theme root lacks an expected directory.

See Troubleshooting for what to do about the common ones.