Giter VIP home page Giter VIP logo

Comments (4)

AriPerkkio avatar AriPerkkio commented on August 16, 2024

Try changing target of esbuild:

import { defineConfig } from "vitest/config";

export default defineConfig({
  esbuild: {
    target: "es2022",
  },
  test: {
    // ...
  },
});

This is not part of Javascript syntax and ESBuild will just parse it and pass through. If the target is something else than esnext, it will be transformed: https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md#0185

This syntax is not yet a part of JavaScript but it was added to TypeScript in version 4.9. More information about this feature can be found in microsoft/TypeScript#49705. Auto-accessors will be transformed if the target is set to something other than esnext

When esbuild doesn't transform this non-JS syntax, Rollup will fail to parse the file.

from vitest.

sheremet-va avatar sheremet-va commented on August 16, 2024

@AriPerkkio should we automatically lower esbuild target to the lowest Node.js we support?

from vitest.

khaosdoctor avatar khaosdoctor commented on August 16, 2024

Yep, that worked fine @AriPerkkio thanks!

from vitest.

AriPerkkio avatar AriPerkkio commented on August 16, 2024

should we automatically lower esbuild target to the lowest Node.js we support?

I'm not sure. As esbuild is only used for TS files, it would create a weird situation where different syntax would not work on JS file.

from vitest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.