Skip to content

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

@Hajime-san

Description

@Hajime-san

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

if (tmp && tmp.resolvedBy !== "vite:resolve") {

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

const type = getDenoType(id, options.attributes.type ?? "default");

Metadata

Metadata

Assignees

No one assigned

    Labels

    featNew feature or requestupstreamThe issue is with an upstream dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions