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

Installation is impossible, if not using Yarn or NPM #105

Open
henrikbjorn opened this issue Dec 27, 2024 · 5 comments
Open

Installation is impossible, if not using Yarn or NPM #105

henrikbjorn opened this issue Dec 27, 2024 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@henrikbjorn
Copy link

Trying to add Maglev to a site that is already using vite_rails seems to be impossible without jumping through a huge amounts of hoops.

It seems that Maglev is instantiating its own ViteRuby instance instead of using the singleton already available ViteRuby.instance and then forces the usage of yarn or npx.

Is there a reason for not "just" having a dependency added to package.json and using the normal flow for handling npm dependencies?

Also is there a reason for the "engine" custom vite configuration, instead of helping the user to configure their current setup?

@j-mcnally
Copy link

not a solution but willing to offer my take, that for rails users who dont use vite, the engine approach abstracts away a lot of the complexity.

@henrikbjorn
Copy link
Author

@j-mcnally However, I do use vite_rails :)

I think that the best approach would be to do something like ActiveAdmin, which publishes a NPM package for their Javascript. Which would make me able to create an entrypoint and import that.

@henrikbjorn henrikbjorn changed the title Installation is impossible, if not using Yarn og NPM Installation is impossible, if not using Yarn or NPM Dec 31, 2024
@did did self-assigned this Jan 5, 2025
@did did added bug Something isn't working enhancement New feature or request labels Jan 5, 2025
@did
Copy link
Contributor

did commented Jan 5, 2025

@henrikbjorn I'm going to see how difficult it is to add support for pnpm. 🤞

Regarding your solution, I'm not a big fan of the NPM package solution. The main reason is that it'd add an extra layer of complexity when releasing a new version (ie: plus potential version syncing issues).

@henrikbjorn
Copy link
Author

@henrikbjorn I'm going to see how difficult it is to add support for pnpm. 🤞

Regarding your solution, I'm not a big fan of the NPM package solution. The main reason is that it'd add an extra layer of complexity when releasing a new version (ie: plus potential version syncing issues).

The complexity of a separate Vite install is also quite high, also since I suspect it will inherit the ENV configuration and with no real way to alter the Vite config for Maglev.

@henrikbjorn
Copy link
Author

Also Vite is great, but wouldn't it be possible to have the same assets build already for usage with importmaps ?

That would also greatly decrease the barrier of usage for standard and new rails app, where importmaps are the defaut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants