fix: specify own Node version as target when bundling config files
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.nodeis always present and in X.Y.Z format (at least bun seemed to have this) - Compatibility between esbuild and Node versions
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?
CI failed, but I think it will succeed on re-run (I don't have permission to do that).
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.
/ecosystem-ci run
📝 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
The analog fail seems to be something on their end. I think this is ready to go in the next minor.