GithubHelp home page GithubHelp logo

Comments (5)

vedmant avatar vedmant commented on June 18, 2024

This edit fixes my issue:

// lang.js

...
  _setRuleMessage: function(lang, attribute, message) {
    this._load(lang);
    if (message === undefined) {
      message = this.messages[lang].def;
    }
    // Added this line
    if (typeof this.messages[lang] === 'undefined') {
      this.messages[lang] = {}
    }
    this.messages[lang][attribute] = message;
  },
....

from validatorjs.

AlonBruQuali avatar AlonBruQuali commented on June 18, 2024

I have this issue as well. seems your fix does the trick!
hopefully it can be patched in soon

from validatorjs.

ashalfarhan avatar ashalfarhan commented on June 18, 2024

I'm facing the same issue, this workaround works fine for me:

import { defineConfig } from 'vite';

export default defineConfig({
  resolve: {
    alias: {
      validatorjs: 'validatorjs/dist/validator.js',
    },
  },
});

from validatorjs.

suvam-jaiswal avatar suvam-jaiswal commented on June 18, 2024

Same issue here,

undefined ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"Cannot set properties of undefined (setting 'notEmptyString')","stack":["TypeError: Cannot set properties of undefined (setting 'notEmptyString')"," at Object._setRuleMessage (file:REDACTED**)"," at Validator.registerImplicit (file:REDACTED**)"," at file:REDACTED**" at ModuleJob.run (file:REDACTED**)"]}

This is when I build this using esbuild and try to run it,

I have this piece of code that fails

import ValidatorJS from "validatorjs"; ValidatorJS.registerImplicit("notEmptyString", validateEmptyString, "The :attribute can not be empty string");

version - "3.22.1"

debugged the code and this this.messages[lang][attribute] = message;fails atthis.messages[lang] being undefined;

undefined ERROR Error: Cannot find module './lang/en' at

_load: function(lang) { if (!this.messages[lang]) { try { var rawMessages = require_method("./lang/" + lang); this._set(lang, rawMessages); } catch (e) { console.error(e, 'some error in load') - // this is where the error comes from } } },

from validatorjs.

zzDave avatar zzDave commented on June 18, 2024

this problem still persists in this library.

from validatorjs.

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.