in here i have stuck mind and cannot found how to solve this
i have a file app.js
& form.js
in app.js
i have some code like:
require('bootsrap');
require('./form.js');
in form.js
i have function code like:
function saveform(somevariable) {
// some code
}
then mix that app.js
file
after that i'm call saveform(somevariable)
function into laravel blade file
lets we call as form.blade.php
<html>
<head></head>
<body>
<script>
var somvariable = 'some attribute';
saveform(somevariable);
</script>
<script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
and i have and error like this in browser
ReferenceError: tinymceInit is not defined
Use window
in app.js
require('bootsrap');
window.form = require('./form.js');
in form.js
export function saveform(somevariable) {
// some code
}
in form.blade.php
<html>
<head></head>
<body>
<script src="{{ mix('js/app.js') }}"></script>
<script>
var somvariable = 'some attribute';
window.form.saveform(somevariable);
</script>
</body>
</html>