admin管理员组文章数量:1322838
I added heroicons/vue package on my Laravel/Tailwindcss site and try to use in my Vue page with Composition API :
<BeakerIcon class="size-6 text-blue-500" />
<script>
import axios from 'axios'
import { BeakerIcon } from '@heroicons/vue/24/solid'
import { defineComponent } from 'vue'
...
export default defineComponent({
name: 'personalTicketsList',
components: {
Multiselect,
...
},
setup() {
function personalTicketsListOnMounted() {
...
loadTickets()
} // function personalTicketsListOnMounted() {
onMounted(personalTicketsListOnMounted)
return { // setup return
// Listing Page state
...
BeakerIcon,
}
}, // setup() {
})
</script>
I have an error in my browser's console :
Index.vue:266 [Vue warn]: Failed to resolve component: BeakerIcon
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
at <PersonalTicketsList errors= {} auth= {user: null} ziggy=
Searching in net I found How to set compilerOptions.isCustomElement for VueJS 3 in Laravel project branch :
I modified vite.config.js file :
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import path from 'path'
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
ssr: 'resources/js/ssr.js',
refresh: true,
}),
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => ['md-linedivider'].includes(tag),
},
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'resources/js'),
},
}
});
But even I removed node_modules directory and reinstalled all packages I have the same error ?
How to fix it ?"
"devDependencies": {
"@inertiajs/vue3": "^2.0.0",
"@tailwindcss/forms": "^0.5.3",
"@vitejs/plugin-vue": "^5.0.0",
"@vue/server-renderer": "^3.4.0",
"laravel-vite-plugin": "^1.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.2.1",
"vite": "^6.0",
"vue": "^3.4.0"
},
"dependencies": {
"@heroicons/vue": "^2.2.0",
"@vueform/multiselect": "^2.6.11",
"flowbite": "^2.5.2",
版权声明:本文标题:vuejs3 - Why adding heroiconsvue package on my LaravelTailwindcss site I got error using it? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742117169a2421520.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论