Tracking Vite 8, rolldown issues for `@fresh/plugin-vite`

Open
#3,777 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
deno, typescript, vite

Research direction

Start with the Vite 8 and Rolldown failures listed here, then read the referenced changes in PRs #3760 and #3765 and the deno.ts locations at lines 93 and 146. Reproduce the reported config resolution, SSR build, CSS modules, resolveId, and import attribute issues; the issue does not name tests for each failure. Done means establishing which blockers affect @fresh/plugin-vite and documenting or addressing them so the Vite 8 and Rolldown migration can proceed.

Written by the indexing model from the issue text.

Description

feat upstream

There are some blockers to update Vite 8 and migrate rollup to rolldown.

ref:

Vite 8

requires node:util.parseEnv

Vite 8 requires node:util.parseEnv. So users need to update deno to 2.7.0 or some workaround for themselves.

requires an another cli flag vite --configLoader=native

It fails to resolve module without appending the flag. It seems to be a breaking change for @fresh/plugin-vite.

% cd www
% deno task dev
Task dev vite
...
vite.config.ts (2:22) [UNRESOLVED_IMPORT] Warning: Could not resolve '@fresh/plugin-vite' in vite.config.ts
   ╭─[ vite.config.ts:2:23 ]
   │
 2 │ import { fresh } from "@fresh/plugin-vite";
   │                       ──────────┬─────────
   │                                 ╰─────────── Module not found, treating it as an external dependency
───╯

https://vite.dev/config/#configuring-vite

Alternatively, if you're using an environment that supports TypeScript (e.g. node --experimental-strip-types), or if you're only writing plain JavaScript, you can specify --configLoader native to use the environment's native runtime to load the config file. Note that updates to modules imported by the config file are not detected and hence would not auto-restart the Vite server.

Rolldown

.cjs files transformed to ESM, then parsed as CommonJS

The SSR build errors such as Cannot use export statement outside a module or Cannot use import statement outside a module.

The approach of this PR seems to be resolve the problem. It could be adopt same for rolldown.

vite build - css modules tests failed

seems to be requires:

resolveId hook resolvedBy is not supported

https://github.com/denoland/fresh/blob/0ab5a2ab289689fda48d28c7ac7c2e679059306b/packages/plugin-vite/src/plugins/deno.ts#L93

https://github.com/rolldown/rolldown/blob/2280eb2298e42835c8d1049a5b32486693c45d0e/packages/rollup-tests/src/ignored-by-unsupported-features.md?plain=1#L13-L14

resolveId hook resolvedBy not supported (1)

import attribute is not supported

https://github.com/denoland/fresh/blob/0ab5a2ab289689fda48d28c7ac7c2e679059306b/packages/plugin-vite/src/plugins/deno.ts#L146

Dominant language
TypeScript
Stars
13.8k
Forks
757
Avg merge
3m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from freshframework/fresh

All issues in freshframework/fresh

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.