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

Package broken in Vite #224

Closed
Hurtak opened this issue May 29, 2024 · 3 comments
Closed

Package broken in Vite #224

Hurtak opened this issue May 29, 2024 · 3 comments

Comments

@Hurtak
Copy link

Hurtak commented May 29, 2024

This package does not seem to be working in Vite.

I managed to fix it with the following patch

diff --git a/dist/esm/hunspellLoader.js b/dist/esm/hunspellLoader.js
index a95a3d39912df63dd8bfdaf531b2b5997d82efa2..4f9471cd4ad45fc8ae848904bc3f5aecfa5f6cc3 100644
--- a/dist/esm/hunspellLoader.js
+++ b/dist/esm/hunspellLoader.js
@@ -1,5 +1,5 @@
 import { mountBuffer, unmount } from 'emscripten-wasm-loader';
-import * as nanoid from 'nanoid';
+import nanoid from 'nanoid';
 import { log } from './util/logger';
 import { wrapHunspellInterface } from './wrapHunspellInterface';
 /**
diff --git a/dist/esm/loadModule.js b/dist/esm/loadModule.js
index 0bb04bb9be8d45c3f6351728e51ec9c5ee7a7364..2ef40301ec6ca8b30c0b8b1ba79cdcfcfed63e6b 100644
--- a/dist/esm/loadModule.js
+++ b/dist/esm/loadModule.js
@@ -2,7 +2,7 @@ import { getModuleLoader } from 'emscripten-wasm-loader';
 import { hunspellLoader } from './hunspellLoader';
 import { log } from './util/logger';
 //imports MODULARIZED emscripten preamble
-import * as runtime from './lib/node/hunspell';
+import runtime from './lib/node/hunspell';
 /**
  * Load, initialize wasm binary to use actual hunspell wasm instances.
  *

But not sure if there is something wrong with our build or if this package just does not play well with how Vite/Rollup resolves modules

@kwonoj
Copy link
Owner

kwonoj commented May 29, 2024

This pkg doesn't support syntheticdefaultimport / or esmoduleinterop. You may need to check if relevant configs are set.

@kwonoj kwonoj closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@Hurtak
Copy link
Author

Hurtak commented May 29, 2024

Interesting, we do not have these options set, I tried to switch them both to false in tsconfig but it did not change anything. I guess it could be some Vite/Rollup weirdness. We used to have Webpack and there it worked.

@gion-andri
Copy link

@kwonoj Is there a chance that the package gets updated with esmoduleinterop support? As all vite based builds seem to fail without it.

I tried with Angulars new vite based build system as well as with a vanilla vite setup.

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