twopluszero / next-images

Import images in Next.js (supports jpg, jpeg, svg, png and gif images)
MIT License
949 stars 67 forks source link

Usage with StorybookJS? #95

Open sethmbrown opened 1 year ago

sethmbrown commented 1 year ago

Running into some issues building StorybookJS while using next-images to load SVGs from a sprite sheet.

Dependencies "next": "13.3.0" "next-images": "1.8.5" "storybook": "7.3.2",

Without any modification to StorybookJS webpack, getting the following error -

ModuleBuildError: Module build failed (from ./node_modules/@storybook/nextjs/dist/next-image-loader-stub.js):
TypeError: Invalid SVG
    at Object.calculate (/Users/sethbrown/app/frontend/node_modules/image-size/dist/types/svg.js:89:15)

The app compiles just fine when running locally - only Storybook is throwing this issue.

Any insights on how to address this issue? Thanks.