Open mdartic opened 2 years ago
you found any solution?
// vite.config.js import vue from '@vitejs/plugin-vue' export default { plugins: [vue()], }
Anyone coming here using webpack and vue3 and looking for a solution, this solved the issue for me. Simply put vite.config.js in same directory as your package.json / vue.config.js directory with this and it'll solve the issue.
Sure would be nice if this was in the documents, or at least addressed by Akryum instead of being ignored.
Edit You can also dump it directly into your histoire.config.js
file as well to save on having an extra file cluttering up your project folder.
import { defineConfig } from 'histoire'
import { HstVue } from '@histoire/plugin-vue'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [
HstVue(),
],
vite: {
plugins: [
vue()
]
}
})
@Akryum is there any possibility of having the documents updated to reflect this solution, given how many open issues there are pertaining to this?
Describe the bug
I'm starting a new project, for testing stories on VueJS components with
histoire
.By reading the guide here https://histoire.dev/guide/vue3/getting-started.html, and by installing
histoire
+@histoire/plugin-vue
, adding ahistoire.config.js
, I was thinking it would be okay to create a newmeow.story.vue
file and see it in action in the UI.That's not the case, I encounter the error
Error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
.By thinking again, I install the
@vitejs/plugin-vue
package and add avite.config.ts
like this one :And now, the story is visible.
Do you think it could be nice to add this in the getting started of vue3, by specifying that the vite config and the vitejs plugin need to be either already present or added ?
Reproduction
npm init
npm i -D histoire @histoire/plugin-vue
histoire.config.js
filepackage.json
(see https://histoire.dev/guide/vue3/getting-started.html#command-line-interface)meow.story.vue
(see https://histoire.dev/guide/vue3/stories.html#how-to-write-stories)npm run dev
Then observe the error
System Info
Used Package Manager
npm
Validations