-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Vite + React - leads to undefined error #462
Comments
My suspicion, though I don't know much about "bundling", is that, I believe, the library attempts to load "language files" via I suspect the issue is that the language files are not being bundled by Vite? I'm not sure how/if I can:
Pointers to docs or concepts or appropriate terminology for what I'm looking at here would be GREATLY appreciated!! |
I'm having similar issues when switching over to Vite from Webpack, while using MobX React Form and ValidatorJS as the validator. Setting a field to "required", and attempting to validate it returns the following:
|
Not the best, but with yarn, |
I'm facing the same issue, aliasing the module to point to the import { defineConfig } from 'vite';
export default defineConfig({
resolve: {
alias: {
validatorjs: 'validatorjs/dist/validator.js',
},
},
}); |
This solution worked until I called |
I'm using Nuxt 3 and this trick works fine in development server but with build |
What version of this package are you using?
v 3.22.1
What operating system, Node.js, and npm version?
What happened?
This is likely exactly the same issue as #455
REPRO STEPS (approx. 5 minutes or less):
npm create vite@latest my-vite-react-app -- --template react
cd my-vite-react-app
npm install
npm install validatorjs
src/App.jsx
with the following:npm run dev
What did you expect to happen?
EXPECTED: Both calls to Validator.passes() run without exceptions being thrown, and that the INVALID case returns an appropriate validation message.
ACTUAL: an exception is thrown in the INVALID case and no validation message is available.
Are you willing to submit a pull request to fix this bug?
Yes if someone suggests a valid solution.
The text was updated successfully, but these errors were encountered: