phiny1 / v-currency-field

The Vuetify Currency Field uses Vue Currency Input directive to create a currency component (<v-currency-field>)
https://phiny1.github.io/v-currency-field/
MIT License
60 stars 29 forks source link

v-currency-field does not show up after nuxt build #20

Closed iabukai closed 4 years ago

iabukai commented 4 years ago

It works in development mode, but in production, the input field does not appear and the console shows the following errors.

Error: "No input element found"
TypeError: "this.$refs.textfield.resetValidation is not a function"

"nuxt": "^2.0.0",

I tried to use the v-currendy-field as plugin and as a module too

timmushen commented 4 years ago

I ran into this as well.

goranculibrk commented 4 years ago

@iabukai @timmushen Can you try with treeshaking module? I had the same issue and instead of using 'v-currency-field/nuxt' I've added 'v-currency-field/nuxt-treeshaking' to modules and it worked.

phiny1 commented 4 years ago

If you are using vuetify 2... you have to add v-currency-field with treeshaking, because when you compile the javascript VuetifyLoaderPlugin dont identify v-text-field inside v-currency-field component.

As @goranculibrk said... use treeshaking module,

andresilva-cc commented 4 years ago

Using treeshaking module works on production (build && start), but stops working in development.

hanscristian3799 commented 4 years ago

Using treeshaking module works on production (build && start), but stops working in development. i solved this by adding this code in nuxt.config.js modules, but i dont know if this is a good practice or not. process.env.NODE_ENV !== 'production' ? ['v-currency-field/nuxt', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }] : ['v-currency-field/nuxt-treeshaking', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }],

phiny1 commented 4 years ago

Using treeshaking module works on production (build && start), but stops working in development.

I 'll test treeshaking module in development.

andresilva-cc commented 4 years ago

Using treeshaking module works on production (build && start), but stops working in development. i solved this by adding this code in nuxt.config.js modules, but i dont know if this is a good practice or not. process.env.NODE_ENV !== 'production' ? ['v-currency-field/nuxt', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }] : ['v-currency-field/nuxt-treeshaking', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }],

I'm not sure if it's a good practice, but you could make it simpler by using a ternary if on the module name instead of the whole array.

jacksonsilvadev commented 4 years ago

I have the same problem and this solution my issue

If you are using vuetify 2... you have to add v-currency-field with treeshaking, because when you compile the javascript VuetifyLoaderPlugin dont identify v-text-field inside v-currency-field component.

As @goranculibrk said... use treeshaking module,

phiny1 commented 4 years ago

Using treeshaking module works on production (build && start), but stops working in development.

Using treeshaking module works on production (build && start), but stops working in development. i solved this by adding this code in nuxt.config.js modules, but i dont know if this is a good practice or not. process.env.NODE_ENV !== 'production' ? ['v-currency-field/nuxt', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }] : ['v-currency-field/nuxt-treeshaking', { locale: 'pt-BR', decimalLength: 0, autoDecimalMode: true, defaultValue: 0, valueAsInteger: false, allowNegative: true }],

The problem is not on v-currency-field module, if you are using treeshaking, you have to set it to vuetify to working in DEV:

buildModules: [ ['@nuxtjs/vuetify', {treeShake: true}] ], /* ** Nuxt.js modules */ modules: [ ['v-currency-field/nuxt-treeshaking', { locale: 'pt-BR', decimalLength: 2, autoDecimalMode: true, min: null, max: null, defaultValue: 0, valueAsInteger: false, allowNegative: true }], ],

Here a basic project code: basicNuxt