Minimal browser example for formatting Java with Prettier standalone.
npm install
npm run build
npm startOr open index.html after npm run build.
import * as prettier from "prettier/standalone";
import prettierPluginJava from "prettier-plugin-java";
const formatted = await prettier.format(source, {
parser: "java",
plugins: [prettierPluginJava],
});With prettier/standalone, plugins are not loaded automatically. You must import
the plugin and pass it in plugins.
npm run start:csp-likeThis runs the bundle with string code generation disabled.