There's two issues with the reading of the vite.config.ts
file.
- On Windows (haven't tested on other systems) the file can't be imported with the error:
Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs.
Changing (await import(userDefinedConfigFile))
to (await import(`file://${userDefinedConfigFile}`))
fixes it, but this probably only works on Windows, so a platform check might be required?
- The module importer can't handle TS files, and as such the
vite.config.ts
should instead be vite.config.js
On a side note, the newly added Babel transpiler doesn't seem to actually work, but a vite.config.js
file looking like this:
import { getBabelOutputPlugin } from '@rollup/plugin-babel';
export default {
build: {
rollupOptions: {
plugins: [
getBabelOutputPlugin({
allowAllFormats: true,
presets: [
[
'@babel/preset-env',
{
useBuiltIns: false,
exclude: ['transform-typeof-symbol'],
modules: false,
targets: {
ie: "11"
}
},
],
],
}),
],
},
},
};
Based on this comment gets the Babel transpilation to actually work. The Babel output probably needs additional tweaking to be perfect for KubeJS, I only did some quick testing with it.