Skip to content

vite --version fails on nodejs 18 riscv64 #50503

Closed
@kxxt

Description

@kxxt

Version

v18.18.0

Platform

Linux kxxt2 6.1.42-1-sophgo-05620-gf3e0e4527b17 #1 SMP Wed, 16 Aug 2023 11:11:48 +0000 riscv64 GNU/Linux

Subsystem

v8

What steps will reproduce the bug?

Install vite 4.4.11 in an empty project.

Run node node_modules/.bin/vite --version

How often does it reproduce? Is there a required condition?

100% of the time. No condition is required.

What is the expected behavior? Why is that the expected behavior?

The version string gets printed:

vite/4.4.11 linux-riscv64 node-v18.18.0

What do you see instead?

file:///build/fluidd/src/fluidd/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:9
import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
^^^^^
SyntaxError: Named export 'build' not found. The requested module 'esbuild' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'esbuild';
const { transform: transform$1, formatMessages, build: build$3 } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.18.0

Additional information

nodejs 16 and 19, 20 are not affected.

It turns out that applying this commit to deps/v8 fixes the bug:
v8/v8@70caf33

Metadata

Metadata

Assignees

No one assigned

    Labels

    riscv64Issues and PRs related to the riscv64 architecture.v18.xIssues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions