Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: can't import vite-plugin-wasm 3.4.0 in vite.config.ts #65

Closed
steel97 opened this issue Dec 19, 2024 · 3 comments
Closed

Bug: can't import vite-plugin-wasm 3.4.0 in vite.config.ts #65

steel97 opened this issue Dec 19, 2024 · 3 comments

Comments

@steel97
Copy link

steel97 commented Dec 19, 2024

Hello!
I just upgraded to vite-plugin-wasm 3.4.0 and got this error:

failed to load config from D:\Develop\tests\vite-project\vite.config.ts
error when starting dev server:
file:///D:/Develop/tests/vite-project/node_modules/vite-plugin-wasm/exports/import.mjs:1
import { default as m } from "../dist/index.js";
         ^^^^^^^
SyntaxError: The requested module '../dist/index.js' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async loadConfigFromBundledFile (file:///D:/Develop/tests/vite-project/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:53862:15)
    at async loadConfigFromFile (file:///D:/Develop/tests/vite-project/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:53691:24)
    at async resolveConfig (file:///D:/Develop/tests/vite-project/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:53214:24)
    at async _createServer (file:///D:/Develop/tests/vite-project/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:43529:18)
    at async CAC.<anonymous> (file:///D:/Develop/tests/vite-project/node_modules/vite/dist/node/cli.js:745:20)

Steps to reproduce

  • create new vite project (vue, typescript)
  • install vite-plugin-wasm dependency
  • import vite-plugin-wasm in vite.config.ts
  • run either npm run dev or npm run build

My vite.config.ts:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import wasm from 'vite-plugin-wasm'

export default defineConfig({
  plugins: [vue(), wasm()],
})

NodeJS version: v20.14.0
OS: Windows 11

@shubhexists
Copy link

same issue

@Menci
Copy link
Owner

Menci commented Dec 20, 2024

I accidentally committed "type": "module" to package.json. The fix #66 is coming.

@Menci
Copy link
Owner

Menci commented Dec 20, 2024

Fixed in v3.4.1

@Menci Menci closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants