kouts / vuepress-plugin-vue-example

A Vuepress plugin to display Vue components' live examples and source code inside documentation.
https://next--vuepress-plugin-vue-example.netlify.app/
MIT License
6 stars 5 forks source link

Error importing VueExampleHighlight component from VueExample #8

Closed victorlmneves closed 1 month ago

victorlmneves commented 2 years ago
"dependencies": {
    "vue": "^3.2.25"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^2.2.0",
    "@vuepress/bundler-vite": "^2.0.0-beta.37",
    "@vuepress/plugin-search": "^2.0.0-beta.37",
    "postcss": "^8.4.12",
    "postcss-calc": "^8.2.4",
    "postcss-inline-svg": "^5.0.0",
    "postcss-preset-env": "^7.4.3",
    "postcss-scss": "^4.0.3",
    "postcss-simple-vars": "^6.0.3",
    "rollup-plugin-copy": "^3.4.0",
    "sass": "^1.49.10",
    "style-dictionary": "^3.7.0",
    "typescript": "^4.5.4",
    "vite": "^2.8.0",
    "vue-tsc": "^0.29.8",
    "vuepress": "^2.0.0-beta.37",
    "vuepress-plugin-vue-example": "^2.0.1"
  },
image

image

[plugin:vite:import-analysis] Failed to resolve import "./VueExampleHighlight" from "node_modules/vuepress-plugin-vue-example/src/VueExample.vue". Does the file exist?
[/Users/victorneves/_mycode/yello-ui/node_modules/vuepress-plugin-vue-example/src/VueExample.vue:120:34]()
2  |  // SVG icons from // https://tablericons.com/
3  |  import { loadComponent, loadComponentAsString } from '@temp/loadComponent'
4  |  import VueExampleHighlight from './VueExampleHighlight'
   |                                   ^
5  |  import { markRaw } from 'vue'
victorlmneves commented 2 years ago

@kouts I received a reply but I don't see it here. I'm going to replicate the issue on Stackblitz and then I'll share the link

victorlmneves commented 2 years ago

For some reason, I'm no longer able to reproduce this issue.

kouts commented 2 years ago

Hello @victorlmneves, I've managed to reproduce the issue. This issue happens because Vuepress 2 changed its default bundler to Vite. vuepress-plugin-vue-example is designed to work with Webpack so this is why the compilation fails. In order to use Webpack in Vuepress 2, you have to install vuepress-webpack@next instead of vuepress. You can read more about it here.

kouts commented 1 month ago

Closing this as vuepress-plugin-vue-example@next is now bundler agnostic.