Laravel Nova - поделитесь собственным компонентом для Nova Tools - PullRequest
0 голосов
/ 04 февраля 2020

У меня есть приложение с Laravel Nova, и у меня мало инструментов, эти инструменты используют VueComponents (те же компоненты), проблема в том, что у меня есть дубликаты файлов в каждом инструменте с этими компонентами,

Я пытаюсь найти какое-либо решение для перемещения файлов Vue в одно место (лучшее было бы за пределами nova-components, например resources/js/...). И проблема в том, что когда я создаю VueComponent вне папки инструментов, я не могу импортировать его ... проблема как:

Module build failed: TypeError: /Users/my-comp/Projects/project/test/resources/js/components/NewComponent.vue: this.setDynamic is not a function
    at PluginPass.pre (/Users/my-comp/Projects/project/test/nova-components/Testowy/node_modules/babel-plugin-transform-runtime/lib/index.js:31:12)
    at transformFile (/Users/my-comp/Projects/project/test/node_modules/@babel/core/lib/transformation/index.js:96:27)
    at transformFile.next (<anonymous>)
    at run (/Users/my-comp/Projects/project/test/node_modules/@babel/core/lib/transformation/index.js:35:12)
    at run.next (<anonymous>)
    at Function.transform (/Users/my-comp/Projects/project/test/node_modules/@babel/core/lib/transform.js:27:41)
    at transform.next (<anonymous>)
    at step (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:254:32)
    at gen.next (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:266:13)
    at async.call.value (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:216:11)
    at errback.call (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:184:28)
    at runGenerator.errback (/Users/my-comp/Projects/project/test/node_modules/@babel/core/lib/gensync-utils/async.js:72:7)
    at val (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:108:33)
    at step (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:280:14)
    at gen.next (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:266:13)
    at async.call.value (/Users/my-comp/Projects/project/test/node_modules/gensync/index.js:216:11)
    at <anonymous>
 @ /Users/my-comp/Projects/project/test/resources/js/components/NewComponent.vue 4:21-389
 @ ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}]],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/js/components/Tool.vue
 @ ./resources/js/components/Tool.vue
 @ ./resources/js/tool.js
 @ multi ./resources/js/tool.js ./resources/sass/tool.scss

У кого-нибудь есть решение для моей проблемы? Я имею в виду 1. или как исправить компиляцию инструмента? 2. или как извлечь эти компоненты и использовать / повторно использовать во всех инструментах?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...