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

Issue with Vite: TypeError: runtimeModule is not a function #142

Closed
jenswilms opened this issue Jul 3, 2024 · 1 comment
Closed

Issue with Vite: TypeError: runtimeModule is not a function #142

jenswilms opened this issue Jul 3, 2024 · 1 comment

Comments

@jenswilms
Copy link

jenswilms commented Jul 3, 2024

I run across this issue:

Error in getLanguage: TypeError: runtimeModule is not a function
    at cld3-asm.js?v=13ef29a7:1958:23
    at Module.loadModule (cld3-asm.js?v=13ef29a7:2138:10)

I've been using it in a React app with Vite.

I've been trying to figure out what exactly it was, but ultimately found out that you have to specify the path in which the module gets loaded.

Solution

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

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      'cld3-asm': 'cld3-asm/dist/cjs/index.js'
    }
  }
})
@kwonoj
Copy link
Owner

kwonoj commented Jul 3, 2024

I'm not sure this is specific issue for the pkg itself, since cld3-asm's export is defined pretty standard way: https://github.com/kwonoj/cld3-asm/blob/master/package.json#L5

Sounds like more close to vite's behavior though I can't say 100% for sure.

@kwonoj kwonoj closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 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

2 participants