Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.5 KB

README.md

File metadata and controls

59 lines (41 loc) · 1.5 KB

vite-plugin-corp-headers

An example that shows how to create a custom Vite plugin

Description

vite-plugin-corp-headers is a plugin for Vite.js that is an example plugin showing how to customize the Vite build system. This plugin is designed to seamlessly integrate with Vite.js, leveraging its fast and efficient development server.

How to Use

The example directory is a vanilla Vite project generated with the following options:

npx create-vite@latest

- project name: example
- framework: Vanilla
- variant: Typescript

The vite.config.ts configuration file shows how to use a Vite plugin:

import pluginCORPHeaders from "../src/index";

export default {
  plugins: [
    pluginCORPHeaders({
      // Configuration options
    }),
  ],
};
  1. Build the plugin
npm run build
  1. Start the Vite development server:
cd example
npm run dev
  1. Your development server will be available at http://localhost:5173 by default.

Configuration

The plugin supports the following configuration options:

  • coep: Default "require-corp". Options: ["unsafe-none", "require-corp"]
  • coop: Default "same-origin". Options: ["unsafe-none", "same-origin-allow-popups", "same-origin"] Please refer to the CORP documentation for more details on these configuration options.

License

This plugin is licensed under the Apache 2.0.