Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

update Readme.md about import in cjs #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down