@serwist/webpack-plugin
Version:
A plugin for your webpack build process, helping you generate a manifest of local files that should be precached.
11 lines (9 loc) • 565 B
text/typescript
import { SerwistConfigError, validationErrorMap } from "@serwist/build/schema";
import type { InjectManifestOptionsComplete } from "./types.js";
export const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {
const result = await (await import("./schema.js")).injectManifestOptions.spa(input, { error: validationErrorMap });
if (!result.success) {
throw new SerwistConfigError({ moduleName: "@serwist/webpack-plugin", message: JSON.stringify(result.error.format(), null, 2) });
}
return result.data;
};