jquense / yup

Dead simple Object schema validation
MIT License
22.94k stars 935 forks source link

Uncaught SyntaxError: Does not export 'camelCase' #2219

Closed vinumweb closed 6 months ago

vinumweb commented 6 months ago

Describe the bug I'm using Yup with Nuxt 3 layers but keep getting this error when using the layer in other projects. "Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/tiny-case@1.0.3/node_modules/tiny-case/index.js?v=0ed065ea' does not provide an export named 'camelCase'" I can't seem to fix it in any way, so any help would be greatly appreciated

To Reproduce I can't make a reproduce as you need to publish an npm package and use it in other nuxt 3 projects (because it is a layer im developing)

NOTE: if you do not provide a runnable reproduction the chances of getting feedback are significantly lower

Expected behavior It shouldn't give any errors and work as it did in the nuxt 3 layer playground

Platform (please complete the following information):

image

Additional context Any help is appreciated!

dselivanovvv commented 6 months ago

+1 the same error

vinumweb commented 6 months ago

Hey @dselivanovvv ! I got it fixed by adding the following script to either the layer's nuxt.config.ts or the project's nuxt.config.ts:

alias: {
  yup: 'yup',
},

Hope this fixes it for you aswell, as i was banging my head in a wall for some hours :) Also this code fixes it for all libraries that gives this error, by just changing yup out with the libraries name.

rpatidar commented 3 months ago

I fixed with following fix in my vite config

    optimizeDeps: {
        noDiscovery: true,
        include: ['yup']
    },
Islam8Bahaa commented 3 months ago

I have the same error but iam using vuejs not nuxt can anyone help