vitePluginString 不是函数

vitePluginString is not a function

创建了 vite + svelte

$ npm init vite@latest
✔ Project name: … app1
✔ Select a framework: › svelte
✔ Select a variant: › svelte-ts

想要包含 vite-plugin-string 以使用 glsl 文件

已安装

npm install --save-dev vite-plugin-string

配置vite.config.js文件如下

import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import vitePluginString from 'vite-plugin-string'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [svelte(),vitePluginString()]
})

一旦运行npm run dev

我收到这个错误

> app1@0.0.0 dev
> vite

failed to load config from ....../Six/trailRun/vite.config.js
error when starting dev server:
TypeError: vitePluginString is not a function
    at file:///....../Six/trailRun/vite.config.js?t=1642958252054:8:22
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async loadConfigFromFile (/....../Six/trailRun/node_modules/vite/dist/node/chunks/dep-f5552faa.js:75089:31)
    at async resolveConfig (/....../Six/trailRun/node_modules/vite/dist/node/chunks/dep-f5552faa.js:74656:28)
    at async createServer (/....../Six/trailRun/node_modules/vite/dist/node/chunks/dep-f5552faa.js:60326:20)
    at async CAC.<anonymous> (/....../Six/trailRun/node_modules/vite/dist/node/cli.js:688:24)

我需要做哪些更改才能更正此问题?

模块实际上在default属性:

中导出了插件函数
// vite.config.js
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import vitePluginString from 'vite-plugin-string'

export default defineConfig({
  plugins: [
    svelte(),
    vitePluginString.default(), 
  ],
})

demo