In my laravel project i have written an custom form validation class. after compiling with npm run dev i dont have access to this class.
My files
small-form-validation.js
class SmallFormValidator {
errMsgs = {
required: 'This field is required!',
string: 'Not valid string.',
...
my app.js
require('./bootstrap');
require('./myvendor/small-form-validator');
After compiling i found in the new created app.js file inside the public folder the source from class SmallFormValidator. It seems that he compiled right.
in my blade template i load with the mixing helper the app.js file. in my Javscript inside the blade template i cant create a instance of SmallFormValidation (var sfv = new SmallFormValidation() ).
I think the problems result that
- I dont work with module export and so on
- or i have some scope problems.
Does anyone know how to solve the problem?