bspaulding / rollup-plugin-image-files

Like rollup-plugin-image, but writes image files to dest instead of inlining base64.
MIT License
26 stars 14 forks source link

Error: The "path" argument must be of type string #2

Closed findingorder closed 5 years ago

findingorder commented 6 years ago

Tried including this in my rollup.config.js using

import images from 'rollup-plugin-image-files'

and also included 'image()' in the plugins section. Even without trying to import any image, it throws this error:

[!] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
    at assertPath (path.js:39:11)
    at Object.dirname (path.js:1331:5)
    at Object.ongenerate (/home/me/my-components/my-component/src/node_modules/rollup-plugin-image-files/dist/index.cjs.js:37:21)
    at /usr/local/lib/node_modules/rollup/dist/rollup.js:19615:40
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/rollup/dist/rollup.js:19613:41
    at <anonymous>
bspaulding commented 5 years ago

Should be fixed in v1.4.1, please let me know if not!

jmuenchenberg commented 5 years ago

Encountered the same issue, with version 1.4.1

This happens only when using the code-splitting configuration for rollup

In my case this was fixed by changing line 14 in index.js to const dir = options.dir || path.dirname(options.dest || options.file);

bspaulding commented 5 years ago

@jmuenchenberg thanks! fixed in 1.4.2 🤦‍♂