storybook: [Bug]: vue3-vite crashes when no vite.config
Describe the bug
We have some logic that looks to see if the user has @vitejs/plugin-vue in their config, and if not, we add it.
https://github.com/storybookjs/storybook/pull/20343 recently started pre-bundling the plugin, however it seems not to work. When the plugin is imported, it throws an error:
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at createRequire (node:internal/modules/cjs/loader:1222:11)
at null.../../node_modules/@vitejs/plugin-vue/dist/index.mjs (/Users/ianvs/code/storybook/storybook/sandbox/vue3-vite-default-ts/node_modules/@storybook/vue3-vite/dist/preset.js:2111:39)
at null.__init (/Users/ianvs/code/storybook/storybook/sandbox/vue3-vite-default-ts/node_modules/@storybook/vue3-vite/dist/preset.js:8:54)
For some reason, it’s trying to createRequire(), but there’s no import.meta.url for it to use, so it fails. That’s as far as I’ve gotten.
To Reproduce
Create a vue3 sandbox. Delete the `vite.config.js` file. Run `yarn storybook`.
System
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 16 (8 by maintainers)
I can confirm that this is fixed in the latest beta. Thanks!
@jagoncalves14 we’ll definitely get this fixed, one way or another. We do want storybook to work without a
vite.config.js, and I am working on allowing a path to be specified to the vite config file: https://github.com/storybookjs/storybook/issues/20552.Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.35 containing PR #20787 that references this issue. Upgrade today to the
@nextNPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.
@iamandrewluca did you test this with a vue3 project? I think this is still broken (when a vite config is not used).
Fixed in https://github.com/storybookjs/storybook/pull/20681 by @IanVS