This plugin is failing if the Rollup cache is not enabled.
[!] (plugin zip) TypeError: The "paths[0]" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:406:5)
at validateString (node:internal/validators:162:11)
at Object.resolve (node:path:171:9)
at C:\project\node_modules\rollup-plugin-zip\dist\index.cjs.js:90:53
at Array.forEach (<anonymous>)
at C:\project\node_modules\rollup-plugin-zip\dist\index.cjs.js:77:36
at new Promise (<anonymous>)
at Object.writeBundle (C:\project\node_modules\rollup-plugin-zip\dist\index.cjs.js:72:16)
at C:\project\node_modules\rollup\dist\shared\rollup.js:1002:40
at async Promise.all (index 0)
The issue is path.resolve(distDir, fileName) at index.ts:77 is failing because distDir is undefined instead of a string. It is undefined because when no cache is specified in the RollupOptions, Rollup defaults to NO_CACHE and returns undefined for all keys. const distDir = this.cache.get<string>(Cache.distdir) at index.ts:67 sets distDir to undefined.
When I set cache to true in the RollupOptions, the plugin works as expected.
This plugin is failing if the Rollup cache is not enabled.
The issue is
path.resolve(distDir, fileName)
at index.ts:77 is failing becausedistDir
is undefined instead of a string. It is undefined because when no cache is specified in theRollupOptions
, Rollup defaults toNO_CACHE
and returns undefined for all keys.const distDir = this.cache.get<string>(Cache.distdir)
at index.ts:67 setsdistDir
to undefined.When I set
cache
totrue
in theRollupOptions
, the plugin works as expected.Versions
4.13.0
1.0.3