Closed mddanish00 closed 1 year ago
Same problem
+1
+1
It looks more like Vite bug, but there also may be incompatibility problem with the plugin.
Debugged it to this place
build
contains default values for some reason that cannot be overridden from user config at this point and so it's not possible to fix this on user side.
Here it becomes possible for outputs array to contain entries without dir
And here they fail to resolve.
Related: https://github.com/vitejs/vite/issues/6929
I can confirm that downgrading to Vite 3.1 helps.
It is because of the code below which is not compatible width multiple rollupOptions outputs setting (output[].dir
is undefined).
const outDirs = normalizedOutputs.map(({ dir }) => resolve(dir!))
If i set the output[].dir
, it will throw below
Invalid value for option "output.dir" - you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks.
I haven't find a way to deal with it, maybe you should use Vite below 3.2.0.
v0.7.0 fixed! @Miracutor
Full error message
Can be easily reproduced using react-ts example. I only upgrade both Vite (v3.2.2) and vite-plugin-build (v0.6.0) to the latest version.
From my testing with my own repo, the error starts on Vite v3.2.0. It is okay on v3.1.8 and below.