Coder Social home page Coder Social logo

export statement in CookieControl component's <script setup> about nuxt-cookie-control HOT 9 OPEN

Willo0ow avatar Willo0ow commented on August 11, 2024
export statement in CookieControl component's

Comments (9)

Willo0ow avatar Willo0ow commented on August 11, 2024 1

I managed to create a reproduction - https://stackblitz.com/edit/nuxt-starter-y79koj

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

The error doesn't show in reproduction template, but it seems obvious and the solution is even in vue docs.

The error should show in a minimal reproduction so that I can figure out the actual root cause.
I'm wondering why noone else reported this issue yet, for example.

The export should be in a separate script tag (like vue documentation suggests), or in somewhere in types.

Actually I've taken the export from Vue's documentation: https://vuejs.org/api/sfc-script-setup.html#default-props-values-when-using-type-declaration

from nuxt-cookie-control.

Willo0ow avatar Willo0ow commented on August 11, 2024

I guess that's the origin of the documentation that you used - https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md#default-props-values-when-using-type-declaration - and there is no export.

As vue documentation states "A normal <script> may be needed in cases where we need to: [...] - Declaring named exports."

Moreover if the interface is not imported anywhere, isn't it better to remove the "export" since it's not needed?

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

I guess that's the origin of the documentation that you used

I referenced the headline "Default props values when using type declaration" under https://vuejs.org/api/sfc-script-setup.html. The Vue documentation has some difficulties scrolling to the given title.

Moreover if the interface is not imported anywhere, isn't it better to remove the "export" since it's not needed?

Maybe. Please create a minimal reproduction as noone else reported this issue since this module is used by dependents 🙏 Reproducing a failure is more actionable to me than a document link in this case.

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

Thank you! Could you please make it minimal, i.e. let it only include nuxt and @dargmuesli/nuxt-cookie-control, dropping eslint, typescript and vite related stuff? That way we could verify that it's indeed @dargmuesli/nuxt-cookie-control causing the issue.

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

I've gone ahead and stripped other configuration and the development server starts fine this way: https://stackblitz.com/edit/nuxt-starter-72gc6p
It appears the error is related to adding something else to the nuxt + cookie-control mix.

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

If you could figure out which other dependency makes the error pop, I'm trying to see if removing the export causes any other problem (dargmuesli/vio#94).

from nuxt-cookie-control.

dargmuesli avatar dargmuesli commented on August 11, 2024

Btw, the RFC's artifact in the Vue documentation was changed to resolve vuejs/docs#1678.

I've created vuejs/docs#2532 to sort out what the proper way to fix this is.

from nuxt-cookie-control.

Willo0ow avatar Willo0ow commented on August 11, 2024

It looks like it's this dependency that causes the problem "vite-plugin-vue-type-imports".
Thanks for creating vue issue, I'm curious what's the solution here.

from nuxt-cookie-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.