jw-12138 / vite-plugin-vsharp

Compress Images for the Web with Vite and Sharp
MIT License
43 stars 0 forks source link

TypeError: vsharp is not a function #10

Closed ghost closed 1 year ago

ghost commented 1 year ago
failed to load config from C:\Users\lvrs\Projects\vite-test\vite.config.js
error during build:
TypeError: vsharp is not a function
    at file:///C:/Users/lvrs/Projects/vite-test/vite.config.js.timestamp-1674479464184.mjs:5:5
    at async resolveConfig (file:///C:/Users/lvrs/Projects/vite-test/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:61590:28)
    at async doBuild (file:///C:/Users/lvrs/Projects/vite-test/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:44358:20)    at async build (file:///C:/Users/lvrs/Projects/vite-test/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:44347:16)    at async CAC.<anonymous> (file:///C:/Users/lvrs/Projects/vite-test/node_modules/vite/dist/node/cli.js:808:9)

My vite.config.js file:

import vsharp from "vite-plugin-vsharp"

export default ({
  plugins: [
    vsharp()
  ]
})

Am I missing something or is this a plugin bug?

ghost commented 1 year ago

In node_modules\vite-plugin-vsharp\package.json I changed "main": "./d/vsharp.js" to "main": "vsharp.js", and added "type": "module". I don't know if this is the correct fix, but now the plugin seems to be working.