From 3deaf07785e65b5752ce4e26a153f2ce95a1141d Mon Sep 17 00:00:00 2001 From: reinerBa <4329883+reinerBa@users.noreply.github.com> Date: Sat, 26 Feb 2022 22:35:55 +0100 Subject: [PATCH] update Readme.md about import in cjs In CJS-Files the plugin needs to be imported different. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index cee487d..8aace9b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,18 @@ export default defineConfig({ plugins: [sri()] }) ``` +If your importing file is not an ESM file, you need to import dynamically + +```js +import { defineConfig } from 'vite' + +export default defineConfig(async ({ command, mode }) => { + const sri = await import('@small-tech/vite-plugin-sri') + return { + plugins: [sri.default()] + } +}) +``` Then: