vatson / rollup-plugin-vuetify

Vuetify autoloader 🤖
MIT License
20 stars 1 forks source link

Collection with no paths (ERROR) #5

Closed dsvanidze closed 4 years ago

dsvanidze commented 4 years ago

Hi,

your npm package does not work with rollup.

[!] (plugin at position 9) Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
src/components/Collection/FormElements/InputText.vue?rollup-plugin-vue=script.ts
Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.

The error is caused by this line of code https://github.com/vatson/rollup-plugin-vuetify/blob/master/src/transform.js#L83.

Do you have an idea how can I fix it?

vatson commented 4 years ago

Hey @dsvanidze.

It looks like another use case that I did not predict.

I can not reproduce this error. Could you provide the source of your src/components/Collection/FormElements/InputText.vue or an example based on it?

vatson commented 4 years ago

@dsvanidze

I got it.

You don't define the default export or even <script> section in that component. Right? Honestly, I have not considered this use case. I'll add handling of this.

As a temporary workaround you can add "empty" <script> section with default dummy export. You can find the example https://github.com/vatson/rollup-plugin-vuetify/blob/master/test/src/Empty.vue

Please let me know if this is a different use case and you still face the error using a workaround.

dsvanidze commented 4 years ago

@vatson Thank you very much for your response.

Yes problem was export default {} definition. I used a code like this, because I need it.

const x = Vue.extend({...})
export default x

I changed the pattern to

export default Vue.extend({...})

and it works. However, it would be great if your plugin could detect patterns like this.

Now it only shows a warning: (!) Broken sourcemap https://rollupjs.org/guide/en/#warning-sourcemap-is-likely-to-be-incorrect Plugins that transform code (such as 'at position 9') should generate accompanying sourcemaps.

I also see a lot of errors in the Dev Console of the browser. e.g. Bildschirmfoto 2020-06-01 um 18 43 27

vatson commented 4 years ago

@dsvanidze

Yeah, your case is another case that I just discovered when I was trying to fix a problem of transforming sfc component without script section (I supposed before).

I plan to add support for your case/pattern too.

Regarding your errors. I have never encountered sourcemap and RTL errors. I will take a look, but in a scope of the next separate issues.

Thank you for your feedback and contribution. Feel free to open the other issues with additional details how to reproduce the errors.

dsvanidze commented 4 years ago

Great! Thanks a lot!