vite icon indicating copy to clipboard operation
vite copied to clipboard

fix: specify own Node version as target when bundling config files

Open SegaraRai opened this issue 1 year ago • 1 comments

Description

fixes #17291

I am uncertain if it is safe to specify node${process.versions.node} for target. At least esbuild supports a notation like node22.2.0 and node99.999.9999, but I am not sure about the following points:

  • Whether process.versions.node is always present and in X.Y.Z format (at least bun seemed to have this)
  • Compatibility between esbuild and Node versions

SegaraRai avatar May 24 '24 21:05 SegaraRai

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

I have noticed that the tests in this PR are not working (dynamic imports are not modified by esbuild at all!), and I am wondering what I should do about it. ~~Perhaps I should change~~ I have changed to static import since all Node.js in the current CI support import attributes, but is it acceptable for the tests not to pass in the old (<= v18.19.x, <= v20.9.x) Node.js?

SegaraRai avatar Jul 24 '24 15:07 SegaraRai

CI failed, but I think it will succeed on re-run (I don't have permission to do that).

SegaraRai avatar Jul 24 '24 17:07 SegaraRai

By splitting the test file, the import attributes test can now be run conditionally. I wanted to use dynamic imports in the test files for feature detection, but this was not possible because all imports in the test code are rewritten by Vitest (Vite).

Tested with v18.12.0, v18.19.0, v18.20.0, v20.12.0, and v22.0.0. From v20.0.0 to v20.11.0, for unknown reasons, a problem occurred in another part of the system and the test could not be run.

SegaraRai avatar Jul 25 '24 17:07 SegaraRai

/ecosystem-ci run

bluwy avatar Jul 26 '24 13:07 bluwy

📝 Ran ecosystem CI on 051c2ac: Open

suite result latest scheduled
analogjs :x: failure :white_check_mark: success
astro :x: failure :x: failure
nuxt :x: failure :x: failure
vike :x: failure :x: failure
vite-plugin-react-pages :x: failure :x: failure
vitest :x: failure :x: failure

:white_check_mark: histoire, ladle, laravel, marko, previewjs, quasar, qwik, rakkas, remix, sveltekit, unocss, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress

vite-ecosystem-ci[bot] avatar Jul 26 '24 13:07 vite-ecosystem-ci[bot]

The analog fail seems to be something on their end. I think this is ready to go in the next minor.

bluwy avatar Jul 26 '24 13:07 bluwy