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

Install issues with Bun and Vite 5 / Vitest 1 in templates #795

Closed
2 tasks
birkskyum opened this issue Dec 12, 2023 · 12 comments
Closed
2 tasks

Install issues with Bun and Vite 5 / Vitest 1 in templates #795

birkskyum opened this issue Dec 12, 2023 · 12 comments
Labels
enhancement New feature or request

Comments

@birkskyum
Copy link

Which scope/s are relevant/related to the feature request?

create-analog

Information

When initiating a project using the templates (at least angular 17), I can't install the package.json because of incompatible package versions with vite/vitest/ and nx/vite.

There is a related upstream issue open here:

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@birkskyum birkskyum added the enhancement New feature or request label Dec 12, 2023
@brandonroberts
Copy link
Member

Thanks @birkskyum. I've reached out to the Nx team already, and they will work on support for Vitest 1.0 soon. In the meantime, newly generated apps with npm create analog@latest should have a .npmrc at the root which allows peer dependencies to be installed outside of those defined ranges in the @nx/vite package.

.npmrc

legacy-peer-deps=true

Angular v17.1 should bump Vite up to 5.x also

The other option is to use npm install --legacy-peer-deps, which is similar to what's defined in the .npmrc

@birkskyum
Copy link
Author

@brandonroberts , gotcha, thanks. I hit this because I tried to create analog@latest with bun, which problematically doesn't appear to respect the .npmrc yet.

@brandonroberts
Copy link
Member

Oh, interesting.

I think if you pin Vitest to ^0.34.4, @nx packages to ~17.1.0, and Vite to 4.5.1 that might allow you to install with bun without peer dependency issues.

Vitest 1.0 is mainly needed if you're using component harnesses

@birkskyum
Copy link
Author

birkskyum commented Dec 12, 2023

Changing the package.json in the angular 17 template sure does fix that specific issues.

@brandonroberts brandonroberts changed the title Vite 5 / Vitest 1 in templates Install issues with Bun and Vite 5 / Vitest 1 in templates Dec 12, 2023
@brandonroberts
Copy link
Member

Ok cool. I think we'll update the current template to use those versions to decrease the npm install friction for new apps being generated with the v17/blog templates.

@brandonroberts
Copy link
Member

The packages are aligned in the latest release of create-analog. The following now works without peer dependency installation issues.

npm create analog@latest analog-bun-install
cd analog-bun-install
bun install
bun run dev

@birkskyum
Copy link
Author

seems like this change is in the nx 17.2.5, so it's technically possible to bump the deps now.

@brandonroberts
Copy link
Member

True, but the Angular CLI is still on 4.5.1 until 17.2 gets released which will cause peer dependency issues.

@Jordan-Hall
Copy link

The packages are aligned in the latest release of create-analog. The following now works without peer dependency installation issues.

npm create analog@latest analog-bun-install
cd analog-bun-install
bun install
bun run dev

Running bun run dev with dev is vite dev isn't running in Bun runtime. @brandonroberts you need to use bun run --bun dev to use bun for the runtime otherwise it uses node.

@brandonroberts
Copy link
Member

Yes, I know. There were still some compatibility issues running with the bun runtime, but its been a while since I checked it

@Jordan-Hall
Copy link

Fair enough sorry I was.following the thread and I thought you was saying bun working. Been considering pulling jn angular vite plugins for a pure bun solution

@brandonroberts
Copy link
Member

Created a working solution with Bun runtime and the Vite CLI

https://github.com/brandonroberts/analog-bun-ssr-example

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

No branches or pull requests

3 participants