-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vite.config.ts
doesn't work
#6
Comments
Working on it. |
After some further looking around, it seems Babel does support Rhino as a target for transpiling, so that might be worth looking into. I can't get |
The Babel output works now as of version 1.1.5, but in my attempt to customize the output of Babel (because Rhino seems to have issues with how Babel handles transforming From my testing, regardless of the value in const userDefinedConfig = (await import(userDefinedConfigFile)) as UserConfigExport;
const configValue = userDefinedConfig.default;
if (typeof configValue === 'function') {
const result = await userDefinedConfig({
command: "build",
isPreview: false,
isSsrBuild: false,
mode: "production"
});
Object.assign(baseConfig, result);
} In my testing, something like this will allow the config to actually be properly retrieved. And now onto the second issue: I'm not sure what the actual intent was with using The Seeing as the project already uses lodash, the simplest solution seems to be to replace I could probably open a PR for this if desired, I can't guarantee code quality however, as I've barely touched JS/TS before. |
There's two issues with the reading of the
vite.config.ts
file.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?vite.config.ts
should instead bevite.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: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.
The text was updated successfully, but these errors were encountered: