prettier-standalone

raw JSON →
1.3.1-0 verified Sat Apr 25 auth: no javascript deprecated

Standalone browser build of Prettier, an opinionated code formatter. Version 1.3.1-0 (archived, replaced by prettier's built-in standalone bundles). This package is a legacy wrapper that allowed using Prettier in browser environments before Prettier officially shipped standalone UMD/ESM builds. It aggregates all Prettier language parsers into a single browser-compatible bundle. The official Prettier package now includes its own standalone builds (e.g., 'standalone.js', 'parser-*.js') in the 'prettier' npm package, making this package obsolete. No longer maintained; users should switch to the official 'prettier' package and its standalone modules.

error Cannot find module 'prettier-standalone'
cause The package is obsoleted and not installed; users often mistakenly install the wrong package.
fix
Install 'prettier' instead: npm install prettier
error prettier.format is not a function
cause Using CommonJS require of 'prettier-standalone' in browser without bundler.
fix
Use ES module import from official standalone: import prettier from 'prettier/standalone'
error Uncaught TypeError: Cannot read properties of undefined (reading 'parsers')
cause In official standalone, parsers must be passed as plugins; this package's monolithic bundle made them global.
fix
Import parser modules and pass them in the plugins array: plugins: [parserBabel]
deprecated prettier-standalone is deprecated; use official prettier package standalone builds.
fix Replace import 'prettier-standalone' with 'prettier/standalone' and install 'prettier' instead.
breaking Version 1.x is extremely outdated and incompatible with modern Prettier APIs and parsers.
fix Migrate to prettier@latest and use the official standalone builds.
gotcha This package bundles all parsers in one file; official standalone requires explicit parser imports.
fix With official Prettier, import and register parsers via 'plugins' option.
deprecated Package has not been updated since Prettier 1.3.1 and may have security vulnerabilities.
fix Switch to actively maintained 'prettier' package.
npm install prettier-standalone
yarn add prettier-standalone
pnpm add prettier-standalone

Demonstrates using official prettier standalone in browser with ES module imports from CDN.

// Install: npm install prettier
// Use in browser via script tag (ES modules):
import prettier from 'https://unpkg.com/prettier@2.8.8/standalone.mjs';
import parserBabel from 'https://unpkg.com/prettier@2.8.8/parser-babel.mjs';

const code = 'const x = 1';
prettier.format(code, {
  parser: 'babel',
  plugins: [parserBabel]
}).then(result => console.log(result));
// Output: "const x = 1;"