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

load Soukai only once #139

Open
michielbdejong opened this issue Feb 7, 2025 · 0 comments
Open

load Soukai only once #139

michielbdejong opened this issue Feb 7, 2025 · 0 comments

Comments

@michielbdejong
Copy link
Collaborator

About bookmarks/soukai/demo, where the app from npm run preview is behaving differently from the npm run dev one, Noel wrote:

I looked at the Bookmarks demo and I found the problem. There are two instances of soukai because there is an import to "../../src/modules/Bookmarks" in utils.ts. So the Bookmark model is using one instance of the library (the one inside of bookmarks/soukai/node_modules), whilst the setEngine is using another (the one inside of bookmarks/soukai/demo/node_modules).

I think you can solve this adding the following to the alias in your demo's vite.config.js:

'soukai': path.resolve(__dirname, './node_modules/soukai'),

That way, every time "soukai" is used, it'll import the same folder. Or you could also solve it by using npm workspaces to share the same node_modules folder, etc.

We should try that out!

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

1 participant