Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: usage with Nuxt 3 in combination with static site generation #24

Closed
ahoek opened this issue Jan 23, 2024 · 11 comments · Fixed by #35
Closed

bug: usage with Nuxt 3 in combination with static site generation #24

ahoek opened this issue Jan 23, 2024 · 11 comments · Fixed by #35
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ahoek
Copy link

ahoek commented Jan 23, 2024

Expected Behavior

The component works the same as the non--static-site generated variant

Actual Behavior

The component works correctly in dev mode. When I generate the static site, I'll get the error:

ERROR  Unknown file extension ".css" for /xxx/node_modules/.pnpm/vuetify@3.5.1_typescript@5.3.3_vite-plugin-vuetify@2.0.1_vue@3.4.5/node_modules/vuetify/lib/components/VCode/VCode.css

If I add 'v-phone-input' to the "build.transpile" array, the site generates without issue, but I get another error when running via dev :

SyntaxError: The requested module '/_nuxt/@fs/xxx/node_modules/.pnpm/country-telephone-data@0.6.3/node_modules/country-telephone-data/country_telephone_data.js?v=55c67d9c' does not provide an export named 'allCountries' (at v-phone-input.js?v=55c67d9c:3:10)

I don't know if this is an error in the component, or in my configuration

Steps to Reproduce the Problem

See the behavior above.

Specifications

  • OS: MacOS
  • Browser: Chrome
  • Browser version: Version 120.0.6099.234 (Official Build) (arm64)
  • Package version: 4.1.1
  • Vuetify version: 3.5.1
@paul-thebaud paul-thebaud changed the title Question of usage with Nuxt 3 in combination with static site generation question: usage with Nuxt 3 in combination with static site generation Jan 23, 2024
@paul-thebaud paul-thebaud added the help wanted Extra attention is needed label Jan 23, 2024
@paul-thebaud
Copy link
Owner

Hello @ahoek, I'm not using nuxt at all. The first CSS error looks related to Vuetify, not VPhoneInput.
For the second one, country-telephone-data is a package used by VPhoneInput, but just like other external packages, it is marked external in the lib build.
I'm sorry, but I don't know how I can help here. Do you still have an error if you just remove VPhoneInput usage?

@ahoek
Copy link
Author

ahoek commented Jan 24, 2024

Thank you for your quick answer. Both errors do not appear when I'm not using the VPhoneInput component. I'll check further and let it know when I found a solution.

@ahoek ahoek closed this as completed Jan 24, 2024
@paul-thebaud
Copy link
Owner

Thanks. I'm leaving this open because it is not solved. We'll wait for your update, but if there is anything else I can do, let me know.

@paul-thebaud paul-thebaud reopened this Jan 24, 2024
@RobertoRGlyde
Copy link

I solve with vite: { ... optimizeDeps: { include: ["v-phone-input > v-phone-input"], }, },

@AndreyYolkin
Copy link

AndreyYolkin commented Feb 28, 2024

You can add dependency in transpile

in nuxt.config.ts

export default defineNuxtConfig({
  ...
  build: {
    transpile: ['v-phone-input']
  }
  ...
})

It should also dedupe vue and reduce bundle size

@paul-thebaud
Copy link
Owner

Looks like I got some work to do on this if Vue code is duplicated in the package export. Tagging this as a bug.

@paul-thebaud paul-thebaud added the bug Something isn't working label Feb 28, 2024
@paul-thebaud paul-thebaud self-assigned this Feb 28, 2024
@paul-thebaud
Copy link
Owner

After investigating, looks like Vue should correctly be excluded from lib build, thanks to the current lib build configuration.

@paul-thebaud paul-thebaud removed the bug Something isn't working label Feb 28, 2024
@pperzyna
Copy link

I can confirm, that the issue exists.

@paul-thebaud
Copy link
Owner

paul-thebaud commented Jun 18, 2024

Hello everyone having this issue, I'm trying to improve Nuxt support, but this may take a bit of time and testing. I'll keep in touch.

@paul-thebaud paul-thebaud added the bug Something isn't working label Jun 18, 2024
@paul-thebaud paul-thebaud changed the title question: usage with Nuxt 3 in combination with static site generation bug: usage with Nuxt 3 in combination with static site generation Jun 18, 2024
@paul-thebaud
Copy link
Owner

I'm back. I released v4.2.0-alpha.0 as a next tagged release.
Could someone else try it please?

npm install v-phone-input@next

If everythings good, I will release stable v4.2.0.

After investigation, this issue had two causes:

You can also try out VPhoneInput+Nuxt inside this Stackblitz playground.

@paul-thebaud
Copy link
Owner

Closing as it should be fixed in v4.2.0. Feel free to open a new issue if you still have problems with Nuxt integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants